【发布时间】:2013-07-16 11:56:38
【问题描述】:
我的 ASP.NET MVC 应用程序有问题,这在本地一切正常,包括 azure 模拟器,但在发布到 azure 后,路由停止工作,我收到此错误
路由表中没有与提供的值匹配的路由
这是我进入 RouteConfig
的路线routes.MapRoute(
"Default", // Route name
"{controller}/{action}/", // URL with parameters
new { controller = "Home", action = "Index"} // Parameter defaults
);
routes.MapRoute(
"Default2", // Route name
"{controller}/{action}/{urltoken}/{id}", // URL with parameters
new { controller = "Home", action = "Index", urltoken = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
);
每次我尝试登录时都会发生这种情况,在表单提交后出现错误..
有人知道为什么路由不能在 azure 中运行吗?
这是错误的图像:
!链接图片>1
更新:
我正在阅读一些谈论的帖子
<modules runAllManagedModulesForAllRequests="true" />
a 将对此进行测试..
<modules>
<remove name="SessionAuthenticationModule" />
<add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
【问题讨论】:
-
去掉第一个路由
{controller}/{action}/的尾部斜杠,移动到最后一个注册的路由。
标签: asp.net asp.net-mvc-4 azure