I have only started to look for a solution to a similar problem. I see this is an old thread but thought adding more details may prompt for solutions or help others who come across this:
I have a basic webservice which runs fine in my local development (XP Prof, VS2005 Prof, Casini browser).
The asmx file is at the path: /templates/Public/services/storeLinks.asmx and has among other webmethods 'StoreLink'.
Once deployed to editor environment (Win2003 Server, IIS6.0) the same call (jquery->ajax) is along the lines of:
$.ajax({
type: "POST",
url: "/templates/Public/services/myLinks.asmx/StoreLink",
data: {'linkID': link.attr("name")},
contentType: ...[snip]
results in the following log entry.
System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/StoreLink'.
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.WebServiceHandlerFact...[snip] can post more!
NO SOLUTION yet but have been investigating aspects of correctly setting up webservices under IIS6.0. Seems okay.
Any pointers would be appreciated.
Hi there!
I am having the same problem and was wondering if anyone had come accross a solution yet?
I am using jquery to make an ajax call. The server is Windows server 2003 (32 bit), running IIS 6. My webservices are loated in a folder off the website root called webservices. I have added the following to the web.config:
<location path="Webservices">
<system.web>
<webServices>
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
<add name="HttpSoap" />
</protocols>
</webServices>
<httpHandlers>
<clear />
<add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true"/>
</httpHandlers>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
I am making the ajax call using the following javascript:
var webserviceurl = "/Webservices/FundPricesGetter.asmx/GetAllVisitorIdentityFundPricesHtml";
var allVisitorIdentityFundPricesXml = $.ajax({
type: "POST",
complete: function() {
},
async: false,
url: webserviceurl,
data: "visitorIdentity=" + getCookie("visitoridentity")
}).responseText;
It all works fine on my development computer, just not on the server. I keep getting the error: "No http handler was found for request type 'POST'".
Thanks in advance.
http://siderite.blogspot.com/2009/03/http-error-405-http-verb-post-used-to.html
In Glocal.asax:
//The BeginRequest event is fired for every hit to every page in the site
void Application_BeginRequest(Object Sender, EventArgs e)
{
var extensions = new[] {".asmx", ".svc"};
foreach (var ext in extensions)
{
var index = Context.Request.Path.IndexOf(ext, StringComparison.CurrentCultureIgnoreCase);
if (index <0) continue;
var path = Context.Request.Path.Substring(0, index + ext.Length);
var pathInfo = Context.Request.Path.Substring(index + ext.Length);
var query = Context.Request.Url.Query ?? "";
if (query.StartsWith("?")) query = query.Substring(1);
Context.RewritePath(path, pathInfo, query);
break;
}
}
You could also make it into a httpmodule.. If you do that it is easier to tourn it on/off.