Home » ASP » Getting 404 error after publishing with .Net4.5 from Visual Studio 2012

Getting 404 error after publishing with .Net4.5 from Visual Studio 2012

After the migration to the new framework you can have the scenario where it works on your computer but not when publishing. Even publishing to the local IIS on the computer may work but not on a remote one.

The 404 page is shown without any more information. To solve this issue, I created a MVC3 web application and published. It works! I did the same with an MVC4 and it was also working.

The difference between the two projects was that the web.config file has different assemblies version in the config file.

    <compilation debug="true" targetFramework="4.0">
        <add assembly="System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

As you can see I have in the code above the version 1.0 for Helpers and Routing and this is problematic because the assembly I have in the project has been converted to the version 2. So two options : migrate everything with MVC4 and use the version 2 or use MVC3 with the version 1.

I hope that if you fall into this type of 404 error after migrating from Asp.Net 4 to 4.5 that you will think to check all references.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.