I have a Web Api application. It works perfectly well when I tested it using the VS 2010 debugging dev server. But I now deployed it to IIS 7.5 and I am getting a HTTP 404 error when trying to access the application.
Here is my web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-FlowGearProxy-20123141219;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="true" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
In my case, the issue was simply that I was trying to access the site at
myserver.myintranet.com/mysite
But the web site binding for http in IIS didn't have the host name specified in the binding. It had worked before and I have no idea how that got blown away.
Once I put
myserver.myintranet.com
into the host name the 404 was gone.In IIS Manager you go into Bindings... in the actions pane, then edit the http binding to specify the host name.
Had the same issue, a 404 response for the web api controllers when served from the IIS but everything worked fine from VS2010. None of the above solutions worked for me. Eventually I found that the problem was that we added WSE 3.0 support for the application and the Microsoft.Web.Services3 dll was missing in the application's /bin directory. Weird, but after copying the dll, the route mapping started to work.
I recently had a 404 not found error with all my Web Api 2 routes/controllers. So I went onto the actual server and tried to browse using localhost instead of the hostname and got "404.7 Not Found - The request filtering module is configured to deny the file extension".
This SO post help me solve it.
I had a similar problem. I had the right settings in my web.config file but was running the application pool in Classic mode rather than Integrated mode
i do nothing, just add this tag in web.config, its working this issue come up one of the following points
Use Web Api in the same project using MVC or asp.net forms
Use RouteConfig and WebApiConfig in Global.asax as GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes);
Use RouteConfig for 2 purposes, asp.net forms using with friendlyurl and mvc routing for MVC routing
we just use this tag in web.config, it will work.
If IIS is installed or enabled after ASP.NET, you will need to manually register ASP.NET with IIS in order for your .NET application to work.
For Windows 7 and earlier:
For Windows 8 and later: