![](/img/trans.png)
[英]Cannot open asp.net mvc website in browser using IIS express
[英]ASP.NET MVC website getting redirected to local IIS instead of IIS express on any browser
目标:
在任何浏览器上在IIS Express上本地运行ASP.NET MVC网站。
历史:
关注的项目是一个ASP.NET MVC网站,最初设置为使用启用了SSL的本地IIS。 我尝试在IIS Express上进行设置:
RouteConfig.cs文件
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "_View", id = UrlParameter.Optional }
);
}
web.config中有2种重定向可能性
用于身份验证
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
用于错误处理
<customErrors mode="RemoteOnly" defaultRedirect="~/Views/Error/Error.html" redirectMode="ResponseRewrite">
问题:
虽然完成了上述设置,但站点将重定向到本地IIS( https:// localhost )而不是IIS express(例如http:// localhost / 12345或https:// localhost / 12345 )。
到目前为止尝试了什么:
Apply server settings to all users (store in project file)
被选中 。 网站上有一个问号,在IIS内部,这一定是可以忽略的
删除https绑定后,重定向正在发生,但页面似乎没有加载。
Visual Studio允许调试Application_Start()
和Configuration(IAppBuilder app)
。 之后,任何突破点都不会被击中。
所有浏览器上的所有控制器和操作都会发生这种情况。
不知道这背后的黑客是什么......
要在启用SSL的IIS Express(而不是本地IIS)上运行ASP.NET MVC网站,需要确保5位数URL端口以443 xx开头
其中xx的范围是0到99
现在, 重定向也没有发生 。 该网站完全在IIS Express上运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.