Make sure you've done the following:
- Installed latest Core hosting bundle. If not, go here and look for "Hosting Bundle" https://dotnet.microsoft.com/download/dotnet-core/3.1 (you should go there on regular basis, a new version about every month, latest is 3.1.7 when writing this)
- In app pool, make sure .NET framework is not selected
When publish, use
Deployment Mode = Framework-Dependent
Target Runtime = win-x64
In your publish profile (you find this file in project folder /Properties/PublishProfiles/YourProfileName.pubxml) after saving the profile, you'll need
<EnvironmentName>Production</EnvironmentName>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
InProcess is the fastest option when using IIS. When running publish, this will end up in your generated web.config like this
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\YourWebApp.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
When deploying to a staging server, create a new publish profile, and use
<EnvironmentName>Staging</EnvironmentName>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
When you get answer from
https://localhost:5001/
you are running Kestrel, not IIS