![](/img/trans.png)
[英]Unable to connect to the remote server (ftp works in development but not in production)
[英]RouteMapping works on development server but results in 404 in production
我在Global.asax中的以下代碼中,該代碼位於具有Webforms而不是MVC應用程序的網站項目中:
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("Documents", "documents/{document-id}/", "~/GetDocument.aspx");
}
路由映射在運行IIS Express的開發環境上可以正常工作,但是在生產環境中它返回404錯誤。
該服務器運行IIS 7,並具有幾乎相同的web.config文件。 我還無法確定在dev web.config和生產版本之間可能引起原因的任何變化。
我的路線映射如何在我的開發環境中而不在我的生產環境中起作用?
您是否嘗試過在web.config中指定runAllManagedModulesForAllRequests =“ true”?
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
在StackOverflow中有與此相關的查詢:(1) IIS 7忽略不具有文件擴展名的MapPageRoute (2) 為什么MapPageRoute / RedirectToRoute在開發機器上而不在生產服務器上起作用?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.