Reputation: 3178
I seem to encounter a very specific problem, apologies for length of question.
I have a script service physically residing at /somepath/service.asmx
.
I am using a url rewriting module (UrlRewritingNet v2.0) to rewrite calls from /service.asmx
to my physical location. This module uses .Net's HttpContext.RewritePath()
functionality.
My service exposes method dosomething
, and on my page there is a script call:
$.ajax({
type: "POST",
url: "/service.asmx/dosomething",
data: JSON.stringify(inputData),
contentType: "application/json; charset=utf-8",
dataType: "json"
});
When I run this code in IIS - it returns status code 200
, but when I run this code on VS dev server - it returns 405 Method Not Allowed
.
Error message from stack trace is:
"The HTTP verb POST used to access path '/somepath/service.asmx/dosomething' is not allowed."
Notice that in this message the path seems to be routed correctly.
The interesting thing is - I'm almost positive this is a routing issue, because when I change my ajax call to the full url /somepath/service.asmx/dosomething
- both IIS and VS dev server work fine.
Any ideas how to avoid that 405?
Upvotes: 2
Views: 278