Wednesday, December 22, 2010

HTTP 500 Errors With Invalid Request Format After Upgrading Site to .NET 4.0

Problem: After upgrading an ASP.NET site to 4.0 you get HTTP 500 errors with exceptions when Javascript is making web service calls: “System.InvalidOperationException: Request format is invalid: application/json; charset=utf-8.” You’ve used IIS Manager to change the application pool to specify .NET 4.0 but the problem persists.

Solution: Change to the 4.0 framework folder (C:\Windows\Microsoft.NET\Framework64\v4.0.30319 in my case) and run aspnet_regiis.exe. You’ll need to determine which option you want – check the help before running and determine what you need.

For whatever reason, simply changing the application pool’s version value in IIS Manager didn’t work. Using the big hammer of aspnet_regiis.exe fixed things up.

3 comments:

David De Sloovere said...

Thanks a lot. I was close to throwing my laptop against the wall...

This one did it:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -i

Unknown said...

Hello Work at Home Dad, i too am a work at home dad and have a similar problem I think.
I have a very simple test page with a cascading drop down and a webservice to populate the child dropdown.
All works fine on my development machine but when I put it on our server I get that 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()
error and [method error 500] in the drop down.
If I type in the webservice directly in the browser it works fine too (https://www.spasecure.co.uk/spatest/testarea/WebService1.asmx?op=GetItems).
I just wondered if you had any ideas on this?

in hope

Martin Woolley

Mike said...

Thank you for this post!!! This solved my particular problem. I had tried many things up to finding this article and this is the only thing that fixed my issue:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -i

Subscribe (RSS)

The Leadership Journey