gpt4 book ai didi

ASP.NET MVC 4应用程序路由在azure中不起作用

转载 作者:行者123 更新时间:2023-12-02 07:14:53 25 4
gpt4 key购买 nike

我的 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" />

并且将对此进行测试..

       <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>

最佳答案

您可以执行多项检查:

  • 确保 MVC 库的本地复制设置为 true。以下是 MVC 寻找的库:

    System.Web.Abstractions.dll

    System.Web.WebPages.Razor.dll

    System.Web.WebPages.dll

    System.Web.WebPages.Deployment.dll

    System.Web.Razor.dll

    System.Web.Helpers.dll

    System.Web.Mvc.dll

    事实上,我建议您从解决方案的文件夹中引用这些程序集。

  • 其次,您还可以检查 web.config 中 System.webServer 中的以下设置:

     <modules runAllManagedModulesForAllRequests="true" />

关于ASP.NET MVC 4应用程序路由在azure中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17675923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com