Problems deploying .NET Core to IIS. I followed the steps as below:
- Created a website using .NET Core 3.1 with Visual Studio
- Created website inside IIS (pointing to an empty physical path C:\inetpub\mywebsite and address mywebsite.core.com)
- Published my website from Visual Studio into the same folder, C:\inetpub\mywebsite
- Host entry to browse from browser e.g. went to drivers\etc\hosts and added line 127.0.0.1 mywebsite.core.com
- Installed bundles from here:https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-aspnetcore-3.1.5-windows-hosting-bundle-installer
Error is:
HTTP Error 500.30 - ANCM In-Process Start Failure Common solutions to this issue: The application failed to start The application started but then stopped The application started but threw an exception during startup Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265
I have a feeling this might be related to my launchSettings.json file, not sure how it should be adapted...
When I launched my site from Visual Studio it used to open directly to a swagger link, but now after publishing to IIS I can no longer launch it from Visual Studio (unable to connect to webserver IISExpress)... Any help please?
It's a .NET Core 3.1 console app with a Startup that opened a swagger with my APIs before I attempted to publish to IIS.
Later edit: https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.1 this suggests two possible causes: lack of permission to key vaults (not a preoblem, I am logged in Azure with azure cli); and the other one is: "The app is misconfigured due to targeting a version of the ASP.NET Core shared framework that isn't present. Check which versions of the ASP.NET Core shared framework are installed on the target machine."
Later edit: The web.config from C:\inetpub\mywebsite looks like this:
<?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=".\XXX.MyWebsite.Api.RestApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess" />
</system.webServer>
</location>
</configuration>
I actually changed hostingModel="inprocess"
to: hostingModel="outofprocess"
And my Project > Properties > Debug looks like this:
(as you can see I changed from In Process to Out of Process)
and the bindings in IIS look like this:
UPDATE: After all of this, my error changed to:
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure Common solutions to this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port
(it was initially 500.30)
Not really sure what else to try. How do I check if the port is well configured?