asp.net – 与IIS7的ASP MVC路由问题
发布时间:2020-12-16 03:31:55 所属栏目:asp.Net 来源:网络整理
导读:我们在IIS7服务器上部署MVC应用程序时发现问题:任何路由导航都会出现404错误.我在网上发现可以通过将应用程序池管理的管道模式设置为集成来解决问题,但现在我们有例外: Request is not available in this contextDescription: An unhandled exception occu
我们在IIS7服务器上部署MVC应用程序时发现问题:任何路由导航都会出现404错误.我在网上发现可以通过将应用程序池管理的管道模式设置为集成来解决问题,但现在我们有例外:
Request is not available in this context Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Request is not available in this context Source Error: Line 19: Line 20: public override void SetActiveUser(Guid userOid) { Line 21: FormsAuthentication.SignOut(); Line 22: HttpContext.Current.Items[Key] = userOid.ToString(); Line 23: FormsAuthentication.RedirectFromLoginPage(userOid.ToString(),true); 有人有什么想法吗? 解决方法
问题可能出在web.config文件中.从IIS7开始,现在有两个地方可以配置处理程序和模块.当您在经典模式下运行时,就像在IIS 6上运行一样(尽管在IIS7下).
这是配置文件: <system.web> [...] <httpHandlers> [...] </httpHandlers> <httpModules> [...] <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,System.Web.Routing,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35" /> </httpModules> </system.web> 应该只有IIS 6配置. IIS 7配置应放在: <system.webServer> [...] <modules runAllManagedModulesForAllRequests="true" > <remove name="UrlRoutingModule"/> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,PublicKeyToken=31BF3856AD364E35" /> </modules> <handlers> <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler,System.Web,Version=2.0.0.0,PublicKeyToken=b03f5f7f11d50a3a" /> </handlers> </system.webServer> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 为什么我在StateServer模式下运行时会丢失会话?
- asp.net-mvc – .NET-MVC – 通过SSL重写URL的某些URL?
- asp.net-mvc-2 – MVC2:如何确定actionlink是否指向当前页
- 动态填充DropDownList不会在回发ASP.net上保留值c#
- asp.net-mvc-3 – FluentValidation – 验证跨多个属性
- asp.net – 控制器!=业务层?
- asp.net-mvc-3 – URL.Action在构造URL时包含id
- asp.net-web-api – Azure AD / B2C用户的安全API
- asp.net-mvc – ASP.NET MVC 3 Razor Intellisense
- ASP.NET TreeView:Checked更改后的PostBack?
推荐文章
站长推荐
- 初识ABP vNext(1):开篇计划&基础知识
- CommandArgument(与ASP.NET Repeater一起使用)是
- asp.net – 如何在x64中使用WebDev.WebServer.ex
- ASP.NET OutputCache和Cookies
- asp.net-mvc – Elmah.MVC在IIS Express下工作但
- asp.net-mvc – 使用LINQ的多个或单个存储库
- asp.net-mvc – HttpResponse.RemoveOutputCache
- asp.net – .NET 4.5中的样式包和CSS中的图标
- 查看服务器运行多少个ASP.NET Core程序
- 框架升级后某个类型所在程序集发生转移,应用还能
热点阅读