I have written a .NET web Service that is to be consumed by a client outside of my control (my server is a simulator for a live server written in PHP). The web service works as desired but the client does not have the ability to add the .asmx extension, or any extension for that matter, in their calls. They basically use http://localhost/soap/MyWebService while IIS expects http://localhost/soap/MyWebService.asmx. Is there any way to make IIS respond to requests without the .asmx extension?
Add a wildcard mapping, which will route all requests through ASP.NET:
http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-Extensions-in-ASP.NET.aspx
You'll also need to do some URL rewriting, to allow the incoming request http://localhost/soap/MyWebService to map to http://localhost/soap/MyWebService.asmx.
http://localhost/soap/MyWebService
http://localhost/soap/MyWebService.asmx
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
Basically, you could add something like the following to your Application_BeginRequest method:
Application_BeginRequest
string path = Request.Path; if (path.Contains("/soap/") && !path.EndsWith(".asmx")) Context.RewritePath(path + ".asmx");
I haven't tested it (and it's a HACK) but it should get you started.
2.1m questions
2.1m answers
60 comments
57.0k users