404 用于具有 IIS 7.5 的新计算机上的自定义路由
我最近刚刚更换机器,安装了最新版本的 MVC,但无法让我的路线正常工作。我使用的是 IIS 7.5,之前使用的是 7。到目前为止,我已经尝试过以下操作:
1)安装了路由调试器,令人惊讶的是 404 url 显示为与当前请求匹配。诡异的。
2) 确保我在 IIS 中安装了 UrlRoutingModule-4.0
是否还有其他我可能丢失的配置设置?以下是我认为相关的一些设置:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<urlCompression doDynamicCompression="true" doStaticCompression="true" />
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<remove name="ETag" />
</customHeaders>
</httpProtocol>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I just recently switched machines, installed the latest version of MVC and can't get my routes to work. I'm using IIS 7.5, and I had 7 previously. I've tried the following so far:
1) Installed the route debugger, surprisingly the 404 url's show as matching the current request. Weird.
2) Made sure I Had UrlRoutingModule-4.0 in IIS
Are there any other config settings I may be missing? Here are some settings I thought relevant:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<urlCompression doDynamicCompression="true" doStaticCompression="true" />
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<remove name="ETag" />
</customHeaders>
</httpProtocol>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了这篇文章 IIS 7.5 上的 ASP.NET MVC,它帮助了我意识到 IIS 可能没有提供所需的一切。我开始像打地鼠一样检查复选框,所以我不确定是哪个设置完成的。我最好的猜测是“基本身份验证”,因为我的所有内容都位于表单身份验证后面。
I found this post ASP.NET MVC on IIS 7.5, which helped me realize that IIS might not have everything it needed. I started checking boxes like it was whack-a-mole, so I'm not sure which setting did it. My best guess would be 'Basic Authentication', since all my content is behind forms auth.