的.NET Web API没有HTTP资源发现,请求URI相匹配 [英] .Net Web API No HTTP resource was found that matches the request URI
问题描述
我的工作的.NET Web API,它是工作在调试罚款以及对本地主机IIS但是当我发布此服务器启动给以下错误: -
消息:没有HTTP资源发现,请求URI匹配
I am working on .Net Web API which is working fine in debug as well as on localhost IIS but when i publish this to server it starts giving following error :-
"Message": "No HTTP resource was found that matches the request URI
在服务器上,我们根据这个API默认网站应用程序文件夹,但它在本地IIS的默认站点工作正常的应用程序文件夹,以便不应该成为问题。
On server, we have application folder under default site for this API, but it's working fine in application folder under local IIS's default site so that should not be the problem.
现在我试着在处理程序,以下网址规定,但没有奏效设置适当的动词:
MVC 4网页API IIS7.5 HTTP 404页未找到
Now i tried setting proper verb in handler as specified in following url but didn't work:
MVC 4 Web Api IIS7.5 HTTP 404 Page Not Found
此外,我对服务器安装MVC4在以下网址的建议:
的.NET Web API - 404 - 文件或目录未找到一>
Also i have MVC4 installed on server as suggested on following url:
.NET Web Api - 404 - File or directory not found
另外的WebDav模块,处理器可能会错误,所以我也试图消除它,但它给同样的错误。
Also WebDav module, handler may give error so i also tried removing it but it's giving same error.
下面是模块,处理程序设置的Web.config部分: -
Here is the Web.config section for module, handler settings :-
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="*" modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="*" modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
我不跟玩航线的任何地方。我失去了在web.config中或服务器的IIS设置有关的东西/配置?
I am not playing with routes anywhere. Am i missing something regarding settings/configuration in web.config or server IIS ?
推荐答案
这另一个潜在原因是,如果
Another potential reason for this is if the
GlobalConfiguration.Configure(WebApiConfig.Register);
是在
RouteConfig.RegisterRoutes(RouteTable.Routes);
在的global.asax.cs
in global.asax.cs
它需要之前,否则默认RouteConfig路线'吃'的路线的WebAPI - 并试图映射API请求到一个控制器称为API ...
It needs to be before, otherwise the default RouteConfig route 'eats' the WebAPI route - and attempts to map API requests to a controller called API...
这篇关于的.NET Web API没有HTTP资源发现,请求URI相匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!