I have a WCF REST service hosted on the IIS. The URL to invoke the method of the REST service looks like – http://sauravpc1.fareast.corp.microsoft.com/RestWCF/RestServ/GetData.
Now, while trying to invoke this URL or browse it directly I get an error – 503 Service Unavailable.
I am able to browse the help page of the service and the above address is present as the correct endpoint.
Again, if the method name in the WCF service is changed to anything else (ex- GetData1 or GetRestData etc.) it works absolutely fine.
So there is an issue with the particular URI or that particular method name.
We can start with verifying the entries in the IIS logs for both the URLs i.e. while using GetData and while using any other method name, say GetData1.
I noticed in my case the URI with GetData did not have its corresponding entries in IIS logs. However, the GetData1 was present.
We should check the HTTPERR log file to find out the reason why the request was not getting processed for GetData method.
To do that open Run (Windows + R) and type “Logfiles” and press enter. You will have a folder named HTTPERR. Inside that open the most recent file.
If you don’t see the most recent requests, please open the command prompt in an admin mode and type – NETSH HTTP FLUSH LOGBUFFER. Now you will be able to find the most recent entries in the Log File.
For my case there were no reason code available. It was just N/A.
2015-11-24 00:52:31 18.104.22.168 61200 192.168.1.9 80 HTTP/1.1 GET /RestWCF/RestServ/GetData 503 - N/A -
From the above steps we could understand the request was failing at the HTTP.SYS layer but we do not know why. So to better understand we can make use of the tool PerfView. It can be downloaded from here.
To capture perfview data follow the below steps:
a) Open PerfView.exe
b) Select menu “Collect” -> “Collect”
e) Let the merging complete and then open the “Events”.
f) Search with the string – httpstatus=”503”. We can see 3 requests which had failed.
g) Copy the activity ID from any one of the request and then search again with that string.
h) We see the reason as – UrlGroupLookupFailed.
Next, please open a command prompt in admin mode and run the command – NETSH HTTP SHOW URLACL
Reserved URL: http://+:80/RestWCF/RestServ/GetData/ -> This URL seems reserved which is causing the error.
This entry needs to be deleted from the list of reserved URLs.
To do that run the command - netsh http delete urlacl http://+:80/RestWCF/RestServ/GetData/
Once done, we just need to remove the existing application from IIS and host it again.
This should take care of the issue and we should be able to browse the GetData URL again.
Hope this helps!
Saurav Dey (MSFT)