Given a solution containing two websites:
1) ASP.NET based on .NET 4.61
2) .NET Core RC2
After launching iisexpress for (2), MSVS updates the applicationhost.config to contain a few extra lines that appear to be incompatible with (1). This isn't noticed until iisexpress is first shutdown and then attempting to launch (1).
The incompatible lines are:
<section name="aspNetCore" overrideModeDefault="Allow" />
<add name="AspNetCoreModule" image="C:\Program Files (x86)\Microsoft Web Tools\AspNetCoreModule\aspnetcore.dll" />
<add name="AspNetCoreModule" />
When launching (1), a dialog appears stating "IISExpress failed to launch" and an event is written:
The Module DLL 'C:\Program Files (x86)\Microsoft Web Tools\AspNetCoreModule\aspnetcore.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.
Possible solutions?
A) Removed the extra lines before launching (1), how to achieve that automatically?
B) Use a different applicationhost.config for each website, is there an environment variable to set this?
C) Directly fix the problem reported in the event log. Somehow it works when launches the .NET Core RC2 site so that's strange.
D) Use separate solution files that happen to be in different directories. This is not desirable as it is a fairly complex solution.
A similar problem to this will happen if you create a solution with mixed .NET Core RC2 and ASP.NET < 5 projects, then upgrade to .NET Core 1.0. The ASP.NET projects will no longer run.
To fix, delete .vs\config\applicationhost.config and unload and reload the project/solution to force VS to regenerate it properly with . NET Core 1.0 settings, then any legacy .NET stuff will run.
I also figured out Event Viewer logs the exact command line that IIS Express is run with when you try to run it in VS, so you can grab that and stick it in a command prompt to get error output from IIS Express, especially useful if there's no Errors themselves in the Event Viewer.