Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7.5, Web Service and HTTP 405 error

I have a web service which I host on my machine. I use Windows 7 and IIS 7.5.

Problem: When the client tries to consume the web service, he/she gets a HTTP 405 error.

In the log file of IIS, I can see that this is refused because POST verb is not allowed.

Question: How can I allow POST verb for those requests?
Do I have to add mapping of the WSDL file? And if I do, how do I have to configure this mapping? I have checked, and in existing mappings I have nothing for WSDL extension.

Is there maybe another thing to setup on IIS to allow those requests?

Web service is built using WCF.

like image 964
buhtla Avatar asked Nov 26 '10 17:11

buhtla


People also ask

How do I fix the 405 method not allowed error on IIS?

If you don't need to use WebDAV, then the easiest and the best way to fix "405 method not allowed" issue is to remove WebDAV from your system. You can easily get this done in "Turn Windows Features On or Off" simply un-ticking the checkbox.

What causes HTTP 405 error?

The 405 Method Not Allowed error occurs when the web server is configured in a way that does not allow you to perform a specific action for a particular URL. It's an HTTP response status code that indicates that the request method is known by the server but is not supported by the target resource.

What does this mean the page you are looking for Cannot be displayed because an invalid method HTTP verb is being used?

The error message "HTTP Error 405.0 - Method Not Allowed" means that the request was sent to a page that can't handle a POST request.


2 Answers

The listed answer didn't work for me, but I was able to fix the problem by running

"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r

This re-registered the handler mapping for *.svc

like image 30
Jeremy Hutchinson Avatar answered Oct 06 '22 10:10

Jeremy Hutchinson


After hours of struggling, this is final solution that helped me (tested from fiddler):

  1. On IIS 7.5 -> YourWebsite -> Handler Mappings
  2. Choose "Add module mapping" option on the right side of the panel
  3. In "Request path" field enter *.wsdl
  4. In "Module" field enter "ProtocolSupportModule"
  5. Click on "Request restrictions" and go to Verbs tab
  6. Enter POST verb
  7. Save changes

End voila, fiddler no longer answers with 405 but with happy 200.

like image 105
buhtla Avatar answered Oct 06 '22 10:10

buhtla