Thursday, August 18, 2011

Sometimes even the simplest stuff catches you out

I was playing around with using web services in a classic ASP.NET form web application, so that I could easily use jquery ajax calls to modify data. All was working fine until I deployed onto my hosting provider's web space, where I got the following error:
System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/MethodName'
It turns out it's another web.config setting (which makes sense) where you have to specify the required protocols. Here is the code:


<webServices>
     <protocols>
                <add name="HttpGet"/>
                <add name="HttpPost"/>
     </protocols>
</webServices>