![](/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.