November Happy Hour will be moved to Thursday December 5th.

Web services in EPiServer CMS 5

Vote:
 
Has anyone experienced the following error message whenever a web service method is called: The HTTP verb POST used to access path '/WebService.asmx/MethodName' is not allowed This is the error message we get after browsing to the .asmx file and clicking "Invoke" on a "Hello World"-type web method.
#15812
Oct 05, 2007 14:32
Vote:
 
Ive also got the same problem. It seems like webservice doesnt like the wildcard mapping (.*) in iis settings. Havent got any solution to it yet.
#16417
Oct 22, 2007 12:22
Vote:
 
#29837
May 19, 2009 0:12
Vote:
 

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.

#29838
May 19, 2009 0:22
Vote:
 

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.

#31881
Aug 13, 2009 15:57
Vote:
 

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. 

#31909
Edited, Aug 14, 2009 18:29
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.