WebApi’s {“message”:”an error has occurred”} on IIS7, not in IIS Express

asp.net-mvc-4asp.net-web-apiiis-7

I'm working with ASP.NET MVC 4 WebApi and am having a lot of fun with it running it on my local computer on IIS Express. I've configured IIS Express to serve remote machines too, and so other's in my company are using my computer as our webserver.

After deciding this was a less-than-optimal solution, we decided to put the WebApi on a remote server after installing .NET 4.5. When I use fiddler and sent a POST to a controller on my local machine it returns the correct response, yet when I change the domain to the webserver running IIS7 the same POST returns a cryptic

{"message":"an error has occurred"}

message. Anyone have any idea what could be going on?

Best Answer

The problem was a missing dependency that wasn't on the server but was on my local machine. In our case, it was a Devart.Data.Linq dll.

To get to that answer, I turned on IIS tracing for 500 errors. That gave a little bit of information, but the really helpful thing was in the web.config setting the <system.web><customErrors mode="Off"/></system.web> This pointed to a missing dynamically-loaded dependency. After adding this dependency and telling it to be copied locally, the server started working.

Related Topic