Thursday, March 25, 2010

Request format is unrecognized for URL unexpectedly ending in

Today I want to share with you a new problem which I had faced yesterday.
Problem:
It was about web service related error. I have used Web Method() in my application to fill up a country dropdown. Everything was going well but when I had used this web method it showed me an error like this:

System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetCountyList'.

Information:
After googling, I have found the solution.
This error was occured because GET and POST are disabled by default in ASP.NET 2.0 and greater.
Now I would like to share this with you. From msdn I have got some relative information which may help you to get understand clearly.

The .NET-connected Web services support HTTP GET, HTTP POST and SOAP protocols. By default, in .NET Framework 1.0, all three protocols are enabled. By default, in .NET Framework 1.1 or greater, HTTP GET and HTTP POST are both disabled. This is for security reasons.

Applications that use HTTP GET or HTTP POST to invoke a Web service fail when the Web service is upgraded to .NET Framework 1.1 or greater. These applications receive a exception: System.InvalidOperationException: Request format is unrecognized.

Solution:
HTTP GET and HTTP POST may be enabled by editing the Web.config file for the vroot where the Web service resides. The following configuration enables both HTTP GET and HTTP POST:

<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>

For more info pls visits these links:
http://support.microsoft.com/default.aspx?scid=kb;en-us;819267
http://forums.asp.net/t/1459560.aspx
http://aspadvice.com/blogs/ssmith/archive/2007/09/04/FIX-Request-format-is-unrecognized-for-URL-unexpectedly-ending-in.aspx
http://forums.asp.net/t/988377.aspx

4 comments:

Anonymous said...

thanks for sharing it

Unknown said...

welcome, thanks to you to visit my blog. I always welcome any constructive suggestions.

Anonymous said...

Thanks 1000000's. It was my problem too. I think it's one of the best solution. Good Luck

sadegh said...

Thanks it helped me out

Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'

Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...