加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-web-api – .Net Web API未找到与请求URI匹配的HTTP资源

发布时间:2020-12-16 03:48:49 所属栏目:asp.Net 来源:网络整理
导读:我正在研究.Net Web API,它在调试和localhost IIS上运行良好但是当我将它发布到服务器时,它开始给出以下错误: – “消息”:“未找到与请求URI匹配的HTTP资源 在服务器上,我们在此API的默认站点下有应用程序文件夹,但它在本地IIS的默认站点下的应用程序文件
我正在研究.Net Web API,它在调试和localhost IIS上运行良好但是当我将它发布到服务器时,它开始给出以下错误: –
“消息”:“未找到与请求URI匹配的HTTP资源

在服务器上,我们在此API的默认站点下有应用程序文件夹,但它在本地IIS的默认站点下的应用程序文件夹中正常工作,因此不应该是问题.

现在我尝试在处理程序中设置正确的动词,如下面的url中指定但不起作用:
HTTP 404 Page Not Found in Web Api hosted in IIS 7.5

我也按照以下网址的建议在服务器上安装了MVC4:
.NET Web Api – 404 – File or directory not found

另外WebDav模块,处理程序可能会给出错误,所以我也尝试删除它,但它给出了同样的错误.

这是模块的处理程序设置的Web.config部分: –

<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.NETFrameworkv4.0.30319aspnet_isapi.dll" 
       preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="*" modules="IsapiModule" 
       scriptProcessor="%windir%Microsoft.NETFramework64v4.0.30319aspnet_isapi.dll" 
       preCondition="classicMode,bitness64" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>

我不在任何地方玩路线.我错过了关于web.config或服务器IIS中的设置/配置的内容吗?

解决方法

这对我有用:

<remove name="WebDAV"/>

我不知道为什么它安装在服务器上.但这似乎干扰了无扩展处理程序

来自IIS(http://www.iis.net/learn/install/installing-publishing-technologies/installing-and-configuring-webdav-on-iis):

Microsoft released a new WebDAV extension module that was completely rewritten for Internet Information Services (IIS) 7 and above on Windows Server? 2008. This new WebDAV extension module incorporated many new features that enable Web authors to publish content better than before,and offers Web administrators more security and configuration options. Microsoft has released an update to the WebDAV extension module for Windows Server? 2008 that provides shared and exclusive locks support to prevent lost updates due to overwrites.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读