I have created a standalone REST
service using Web API 2
framework. The project contains no UI as the service will be consumed elsewhere on another domain.
The service works completely fine when running locally and all HTTP methods work/return as expected when testing with an in-browser REST client.
However, after publishing the service and deploying to IIS 7.5
, I cannot access any of the resources for any of the routes for my service in the REST client. I am continually being returned a 404 - Resource Not Found
error.
Things I have already done:
Added the following to my Web.Config
:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
Ensured AppPool is correct (as far as I am aware this is correct):
It may also be useful to know my publishing configuration for my publishing profile:
IIS Bindings:
An example URL of how I am trying to access my service in the REST client is as follows:
www.MySubDomain.Domain.co.uk/api/ControllerName/1
(GET)
(This works fine locally using api/ControllerName/1
)
Any additional things to try would be appreciated.
Turns out my bindings were slightly incorrect! As I am hosting it on a sub-domain I did not require the www.
in my bindings. Works fine once I removed these 4 characters!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.