Search code examples
c#iisasp.net-core.net-framework-version

Module "AspNetCoreModule" could not be found for non-Core app


My Solution has projects with a lot of database code, and a web site, all in .Net Framework 4.5. I just added a new Core 2.0 web project from the VS2017 template to the solution, which runs OK.

Now I cannot run the old web site by setting it as the Startup Project. Although it does NOT use Core, but the old .Net Framework 4.5, it causes an error message:

HTTP Error 500.0 - Internal Server Error
Module "AspNetCoreModule" could not be found

How to fix this?


Solution

  • Because I archived the solution to SVN right before and after adding the new Core project, I found that the problem must be in solution file:

    .vs/config/applicationhost.config
    

    where there are several references to this Core module, even if I unload (made not-available) the new Core project. Only after closing VS, removing this config file and restarting VS, the FW 4.5 site will work again.

    I stopped debugging the 4.5 project, reloaded the Core project, and started debugging the 4.5 site. Works OK.

    I stopped debugging the 4.5 project, made the Core project the startup project, and started debugging. The Core site works.

    I repeated to debug the 4.5 project: working.

    Conclusion: removing the application.host file fixed it. Poke was right, the setup got confused.