Ane*_*eef 16 asp.net routing iis-7
我在我们的一个新产品中使用asp.net 4路由,它在开发环境(Visual studio webserver)中工作正常.但当我将它移动到远程iis进行测试时它不起作用.我得到的是404错误页面.我尝试将以下内容添加到web.config并仍然收到错误.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
任何想法如何排序这个问题?
小智 37
我得到了解决方案...在你的web.config中添加以下代码..并且不要忘记在你的模块中添加runAllManagedModulesForAllRequests ="true"..
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add
name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*" path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)