HTTP HEAD Requests get 405 HTTP error when access SOAP Web Services
Most people are familiar with HTTP GET and POST requests. But actually HEAD is another useful verb.
HEAD Request and 405 Problem
Below is the response from an IIS 6 server using WFetch.
Note that the response only contains header information, so it is really a neat way to check site availability.
Here comes the question. Why such requests fail to query information about ASMX files on one of my IIS 6 server?
Analysis Progress
For 405 status code, you may think that HEAD verb is disabled in IIS settings. But actually I have everything set up correctly. Take a look of my IIS Manager,
As I don’t have any third party ISAPI filter or other IIS extension installed, it is really hard to understand the reason, isn’t it?
Some people will suggest I test on IIS 7. Actually the result is the same. Even failed request tracing does not provide much information. The status code seems to be returned from within .NET Framework. So there must be a reason.
The Answer
Well, finally I decided to go back to ABC and started to digest the SOAP protocol itself, and BLAH, the answer is there!
Problem with Message |
HTTP Status Code |
HTTP Reason Phrase (informative) |
Malformed Request Message |
400 |
Bad request |
HTTP Method is neither POST nor GET |
405 |
Method Not Allowed |
Unsupported message encapsulation method |
415 |
Unsupported Media |
Because any SOAP implementation honors the protocol itself and conforms to its requirements, ASP.NET web service as an SOAP implementation for .NET platform also follows the rules and returns 405 for HEAD requests.
Regards,
Lex Li