My WebApi works fine on Visual Studio but doesn't work on IIS
There are several questions I could find on SO and over the internet. However, they weren't the solution to my problem (at least the solutions I've seen so far). Therefore, I need your help.
I created WebApi
with the following lists, which works great when I run it from Visual Studio. But it doesn't work when I publish this to IIS on my own machine.
This gives me HTTP error 404.0 - No error found.
- Operating system: Windows 7
- IDE: Visual Studio 2013
- IIS: version 7.5
This system.webServer
and the applicationSettings
part web.config
:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<applicationSettings>
<SampleAspNetWebApi.Properties.Settings>
<setting name="AuthorityAddress" serializeAs="String">
<value>https://localhost:44333/core</value>
</setting>
<setting name="SampleAspNetWebApi_SmsPanel_SMS" serializeAs="String">
<value>http://something.com/smsws/soap.asmx</value>
</setting>
</SampleAspNetWebApi.Properties.Settings>
</applicationSettings>
This is the routing map:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{action}",
defaults: new { id = RouteParameter.Optional }
);
Finally, this is my controller, which I created for testing purposes only:
public class TestController : ApiController
{
public string Get()
{
return "Just for test";
}
}
UPDATE:
source to share