Reputation: 5582
Environment: Windows Server 2012, IIS8, .Net 4 web application. When I call a web service (AJAX call) like this: http://site.com/srv.asmx/getSomething my request is redirected (302) to http://site.com/srv.asmx/getSomething/Default.aspx Instead of calling getSomething method.
Has anyone seen this before? It is as if IIS (or framework?) doesn't understand that this is a request for *.asmx and just appends the default document.
The exact error message I am getting:
http://site.com/filenotfound.htm?aspxerrorpath=/srv.asmx/getSomething/default.aspx Error 404: File or Page Not Found
Thank you!
--- Update --- I have found the solution myself
--- Solution ---
This behaviour is caused by the Extensionless Url handlers. This KB article helped me a lot: http://support.microsoft.com/kb/2520479
I haven't tried installing the patch (perhaps it is the easiest solution). I have just rearranged the handlers.
For the affected site applicationHost.config (located under C:\Windows\System32\inetsrv\config) had the following:
<location path="site.com">
<system.webServer>
<handlers>
<clear />
<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="TraceHandler-Integrated-4.0" path="trace.axd" verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TraceHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="WebAdminHandler-Integrated-4.0" path="WebAdmin.axd" verb="GET,DEBUG" type="System.Web.Handlers.WebAdminHandler" preCondition="integratedMode,runtimeVersionv4.0" />
--- skipped ---
As you can see - ExtensionlessUrl handler (one of them) is listed at the top. This means it is the first one that gets an opportunity to process the request. So it happily consumes my "extensionless" web service call.
*.asmx handler was there below too but it didn't have a chance to be called.
So to fix this I moved the Extensionless URL handler to the second position from the bottom (just in front of the static file handler):
<system.webServer>
<handlers>
<clear />
<add name="TraceHandler-Integrated-4.0" path="trace.axd" verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TraceHandler" preCondition="integratedMode,runtimeVersionv4.0" />
--- skipped ---
This has resolved this issue for me.
Upvotes: 2
Views: 2513
Reputation: 1903
I had a similar issue, https://ws.qa.llsettlement.com/StandardNotificationReceiver/StandardNotificationReceiver.svc. In my case the server against which I had developed was not redirecting to HTTPS but the problem server was. So I needed to send the request initially through HTTPS. This was accomplished by setting the customBinding to use <httpsTransport />
, which then allowed me to convert the URL to HTTPS over HTTP.
Upvotes: 0
Reputation: 17604
This may be a reason that you are using FormAuthentication
and trying to access the service without login.
You can use location path in that condition
<location path="srv.asmx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Upvotes: 2