HTTP Error 500.0 - Internal Server Error with VS2012 .NET 4.5 local development server

2

I installed Visual Studio 2012 including .NET 4.5. When I make a default MVC 4 Web Api application and attempt to run it I get an Internal Server Error 500.0. I'm wondering if anyone has run into this? I re-installed .NET 4.5, I also have all of the packages available with web platform installer. I can't seem to find any errors or logs for this.

Http Error 500.0 Module: IIS Web Core Error Code: 0x80070585

*EDIT:*I've been able to publish the application to my local IIS and it runs. So the error seems to be specific to development when debugging right out of VS.

asp.net-mvc-4
asp.net-web-api
asp.net-4.5
asked on Stack Overflow Aug 5, 2012 by user1576749 • edited Aug 7, 2012 by user1576749

2 Answers

1

Current solution:

I went into the web project properties, selected the Web tab, and under "Servers" I selected "Use visual studio dev server" instead of the Local IIS. This allows me to run from VS now.

answered on Stack Overflow Aug 7, 2012 by user1576749
0

In my case there was an undocumented requirement that entity classes with RequiredAttribute from DataAnnotations also require the DataMemberAttribute(Required = true) from the older System.Runtime.Serialization.

I only found this error by stopping the debugger on the exception and calling:

response.Content.ReadAsStringAsync().GetAwaiter().GetResult()

...in the Immediate debugging window, which revealed a string containing a message suggesting the above. After adding the DataContract and DataMember attributes the problem was solved and my Web API is now working.

I'm not really happy with that behaviour as I should have been able to see an "Internal Server Error" in the event log or debug window or Global.asax error handler. Seems the Web API is totally disconnected from all of the hosting environment.

I think a filter is needed to screen such responses and write them to the application event log, before I put any Web API solutions in a production environment!

answered on Stack Overflow Jan 28, 2013 by Tony Wall

User contributions licensed under CC BY-SA 3.0