Request format is invalid: application/json; charset=utf-8

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

Advertisement

2 responses to this post.

  1. Hi, what did you change in your config?

    Reply

  2. 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

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.