System.InvalidOperationException: Request format is invalid: application/json; charset=utf-8.
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
it seems the server rejects application/json; charset=utf-8 as content type.
Today I faced the above problem, when I migrated my asp.net 3.5 application to asp.net 4.0 application. My web.config was simple and I copied the web.config content from a new asp.net 4.0 template. I searched for this solution and didn’t find good post to solve my issue. Finally, I have to change my web.config to solve the issue. If you ever face this problem all you have to do is, add the following line under <system.webServer > < handlers>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Happy Coding
Ashfaq
Posted by Me on September 5, 2011 at 3:54 pm
Hi, what did you change in your config?
Posted by Ashfaq on September 6, 2011 at 12:19 am
Sorry Bro, somehow the code got vanished from my post. I will see my web.config file and will post the line tomorrow. For now, you can try with these two lines. I am sure I edited my web.config using lines like these, I have to just confirm by comparing my current project web.config