Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebAPI Error 404.0 - Not Found

We are having issues deploying our WebAPI service onto our production server. 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."

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. 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.

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. We also have an odata service on the same web application and it is all functioning fine. So it seems to be something to do with MVC routing and WebAPI.

We copied across every dll that we could think of to the server but nothing fixed the situation.

Does anyone have any ideas on what could be different between the 2 servers that would cause the error above?

Thanks in advance

like image 598
Ryan Avatar asked Dec 14 '12 04:12

Ryan


People also ask

How do you fix HTTP Error 404.0 Not Found The resource you are looking for has been removed had its name changed or is temporarily unavailable?

To resolve this problem, use one of the following methods: Make sure that the requested resource is at the location that the URL points to. Review the URL that you open in the Web browser. Make sure that no custom filters or modules restrict access to the file that you want to browse.

How do I fix error 404 in Web API?

A simple solution is to check for the HTTP status code 404 in the response. If found, you can redirect the control to a page that exists. The following code snippet illustrates how you can write the necessary code in the Configure method of the Startup class to redirect to the home page if a 404 error has occurred.

How do I fix 404 error in IIS?

Resolution. To resolve this problem, verify that the file requested in the browser's URL exists on the IIS computer and that it is in the correct location. Use the IIS Microsoft Management Console (MMC) snap-in to determine where the file requested must exist in the IIS computer's file system.

How do I set up Web API?

In an ASP.NET application, configure Web API by calling GlobalConfiguration. Configure in the Application_Start method. The Configure method takes a delegate with a single parameter of type HttpConfiguration. Perform all of your configuration inside the delegate.


2 Answers

try this article

HTTP Error 404.0 0 Not Found in MVC

or this

Running ASP.NET MVC Under IIS 6.0 and IIS 7.0 Classic Mode : Solution to Routing Problem

or try adding the following to Web.config:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer>
like image 176
Nerdroid Avatar answered Oct 06 '22 00:10

Nerdroid


This error message is also displayed when running your WebApi using OWIN and you forget to include the following line in your startup class:

app.UseWebApi(config);
like image 34
mkaj Avatar answered Oct 06 '22 00:10

mkaj