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.
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.
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!
User contributions licensed under CC BY-SA 3.0