asp.net-mvcasp.net-mvc-4iis-7.5windows-hosting

Showing Runtime Error in MVC application after deploy


I made a new MVC Project in Visual Studio 2015, then published that package and uploaded into my Windows hosting. After extraction when I browse my URL it shows me this error message. But my application runs on locally just fine.

enter image description here


Solution

  • The custom error pages are not enabled for local in your code, you have to add mode="On". So customErrors looks something like this:

    <customErrors mode="On" defaultRedirect="Error" redirectMode="ResponseRewrite">
      <error redirect="Error/NotFound" statusCode="404" />
    </customErrors>