Hosting .NET Core Apps in IIS
All of the documentation I've seen shows this being a much more complicated process than I have found it to be. For my own memory and for the edification of the rest of the world (if anyone else reads this), here are the steps I have found to be needed to deploy a .NET Core application on IIS as of 2.2.
- Download the latest .NET Core Hosting Bundle and install it.
- Restart IIS using IISRESET from an elevated command prompt (or just restart the server if you feel like it).
- Take the published version of your application produced by Visual Studio and copy it onto the production server.
- Change any application configuration settings.
- In IIS Manager
- Create an application pool. I prefer not to start it right away.
- Set the .NET CLR version to No Managed Code
- If you are using a SQL backend and don't want to setup delegation, change your Identity to a user with database access or use SQL Server Authentication. You will know this is a problem if you are using Integrated Authentication and start receiving error messages about MACHINENAME$ not being able to authenticate.
- Convert your site to an application. Attach it to the application pool you just setup.
- Change your authentication model if so desired.
- Start the application pool if it hasn't already been started.
The full document from Microsoft can be found here.
2/5/20 Update: THE 0x8007000d ERROR
Typically, the cause of this error is a missing or invalid web.config file. The web.config file is not needed for running under .NET directly but is needed for IIS. It should look something like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8129071a-834f-45cd-afd7-ffb49277fc06-->
If everything looks right with that, check your applicationHost.config file under %windir%\System32\inetsrv\config. Make sure there is a section for aspNetCore under system.webServer sectionGroup.
<sectionGroup name="system.webServer">
<---- Other things ---->
<section name="webSocket" overrideModeDefault="Deny" /><section name="aspNetCore" overrideModeDefault="Allow" />
</sectionGroup>
That's all for now.
Comments
Post a Comment