I was able to create a simple test project that basically used the ASP.NET core Empty Web Application project template for Mercury, so it didnāt have much of anything besides an index and privacy page, and get that deployed successfully within IIS. There are still some open questions, but hereās what Iāve learned so far which might help the next guy trying to figure this out:
.NET Core Hosting Bundle Needed (of course)
This is probably obvious, but Iām including it here for completeness.
Application Pool .NET CLR Version
This needs to be set to No Managed Code.
The EXE is not needed
Having the EXE did not solve my issue. However, having the EXE was nice because I could use it to run the app from the folder I published to and verify that it ran successfully (so thus the issue was specific to IIS and not a missing asset or something.) So I think it might be a good idea for ASP.NET Core applications to generate it. But not critical.
web.config is needed
I did seem to need a basic web.config with an aspNetcore handler. Hereās an example of mine (obviously change the DLL name as needed.) I enabled logging which helped solve the remaining issues, then that could probably be disabled.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet"
arguments=".\TestIISInstall.dll"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
Generated .deps.json needed changes
Part of how I got things working was to compare a simple C# ASP.NET Core application that I got working to my Mercury ASP.NET core app. In the logging files I started seeing errors like this:
Error:
An assembly specified in the application dependencies manifest (TestIISInstall.deps.json) was not found:
package: 'Microsoft.Win32.Registry', version: '5.0.0'
path: 'runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.dll'
Also sometimes there were similar errors in the Windows Application Event log. So I edited the above mentioned json file so that it more closely matched the one in the C# file (but still included the Mercury, Elements, and Echoes references.) That seemed to do the trick.
Since this appears to be a file generated during build, and those references do seem to be part of the project template (and hence my project), I havenāt quite figured out yet if the template should be changed or if I will need to get those references working as soon as I try to do anything non-trivial.
Iāve attached a zip of the original JSON file that was generated and also the one that is actually working for me.
TestIISInstall.deps.zip (1.5 KB)
I may have to step away from this for a few days unfortunately, but eventually I hope to get back to it and figure out if those references that I removed from the *.deps.json file are needed or if I can get rid of them in the project as well (which I assume will remove them from the generated *.deps.json).
āAvonelle