今天遇到一个奇怪问题;
某网站,使用VS自带的 Development server启动没有问题。但是用IIS Express启动以后无法访问。
使用IE查看网站查不出什么问题,使用chrome报告错误‘此网页包含重定向循环’。
看来是代码什么地方弄错了,查查代码,登录页面有这样一段;
protected void Page_Load(object sender, EventArgs e){FormsAuthentication.SignOut();string tttt = Request.QueryString["ReturnUrl"];if (tttt != "/luozhuang/Default.aspx"){Response.Redirect("../Default.aspx", true);}
看来问题出在访问路径被写死了。因为IIS Express默认使用的根是/,而 Development server设置的根是/luozhuang。
解决方法就是在IIS Express进行设置;
</site><site name="bsim" id="2048214810"><application path="/" applicationPool="Clr2IntegratedAppPool"><virtualDirectory path="/" physicalPath="E:\luozhuang" /></application><application path="/luozhuang" applicationPool="Clr2IntegratedAppPool"><virtualDirectory path="/" physicalPath="E:\luozhuang" /></application><bindings><binding protocol="http" bindingInformation="*:15792:localhost" /></bindings></site>
然后使用http://localhost:15792/luozhuang 去访问就好了,哎这些程序猿也是让人无语了。