IIS 7.5上的MVC5路由错误(404.0)错误 [英] MVC5 routing error (404.0) error on IIS 7.5
问题描述
关于一切的老故事在开发机器上运行良好但在主机服务器上运行不正常。
An old story of everything works fine on the development machine but not on the host server.
HTTP错误404.0 - 未找到
- 模块 IIS Web核心
- 通知 MapRequestHandler
- 处理程序 StaticFile
- 错误代码 0x80070002
- Module IIS Web Core
- Notification MapRequestHandler
- Handler StaticFile
- Error Code 0x80070002
尝试通过添加< remove name =UrlRoutingModule-4.0/>
来在开发计算机上产生相同的错误 system.webServer - modules 并在添加< add name =UrlRoutingModule-4.0type =System.Web.Routing.UrlRoutingModulepreCondition =/>时解析它;
,但这不适用于主机。我还尝试< modules runAllManagedModulesForAllRequests =true/>
但没有任何改变。
Trying to produce the same error on the development machine by adding <remove name="UrlRoutingModule-4.0" />
to system.webServer - modules and resolving it when adding <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
, but that not works on the host. I've also try <modules runAllManagedModulesForAllRequests="true" />
but nothing changed.
在这里是处理程序部分:
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<remove name="WebDAV" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
更多信息:
- MVC.Net 5.2.2.0
- Windows 2008上的IIS 7.5
- 集成的.Net 4.0应用程序池。
还有什么我应该做的吗?
Is there anything else that I should do?
现在,在<中遇到同样的问题强> IIS8 ,任何想法?
推荐答案
我遇到过类似的问题。事实证明,与虚拟文件夹名称和我正在构建的用于调用Web API路由的URL不一致:
I had similar problem. It turns out to be discrepancy with Virtual folder name and the URL I was constructing to call Web API route:
var URLGetUserAccesses = "/api/Login/GetUserAccesses";
Vs。
var URLGetUserAccesses = "../api/Login/GetUserAccesses";
这篇关于IIS 7.5上的MVC5路由错误(404.0)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!