简体   繁体   English

WebAPI错误404.0 - 未找到

[英]WebAPI Error 404.0 - Not Found

We are having issues deploying our WebAPI service onto our production server. 我们在将WebAPI服务部署到生产服务器上时遇到问题。 When attempting to access the Controller we receive "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." 尝试访问Controller时,我们收到“您要查找的资源已被删除,其名称已更改或暂时不可用”。

We created a new project from the standard WebAPI Template and it has the same problem, so it is definitely not our code that is causing the issue. 我们从标准的WebAPI模板创建了一个新项目,它有同样的问题,因此绝对不是我们的代码导致了这个问题。 We also have another server with the same hosting company and when deployed to that everything works fine. 我们还有另一台服务器与相同的托管公司,并在部署到一切正常。 All IIS features are identical between servers. 服务器之间的所有IIS功能都相同。

At one stage we had the Application Pool set to .Net Framework 2.0 and the Website did not complain about that so it isn't even trying to spin up the service. 在一个阶段,我们将应用程序池设置为.Net Framework 2.0,并且网站没有抱怨,因此它甚至没有尝试启动该服务。 We also have an odata service on the same web application and it is all functioning fine. 我们在同一个Web应用程序上也有odata服务,它运行正常。 So it seems to be something to do with MVC routing and WebAPI. 所以它似乎与MVC路由和WebAPI有关。

We copied across every dll that we could think of to the server but nothing fixed the situation. 我们将我们能想到的每个dll复制到服务器,但没有解决问题。

Does anyone have any ideas on what could be different between the 2 servers that would cause the error above? 有没有人对可能导致上述错误的2台服务器之间有什么不同有任何想法?

Thanks in advance 提前致谢

try this article 试试这篇文章

HTTP Error 404.0 0 Not Found in MVC HTTP错误404.0 0在MVC中找不到

or this 或这个

Running ASP.NET MVC Under IIS 6.0 and IIS 7.0 Classic Mode : Solution to Routing Problem 在IIS 6.0和IIS 7.0经典模式下运行ASP.NET MVC:路由问题的解决方案

or try adding the following to Web.config: 或尝试将以下内容添加到Web.config:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer>

使用OWIN运行WebApi时也会显示此错误消息,并且您忘记在启动类中包含以下行:

app.UseWebApi(config);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM