[英]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.