Issues with Hosting an ASP.NET Core Web Application on IIS

Deborah Lane 5 Reputation points
2023-04-27T13:24:03.91+00:00

Hello Microsoft Forum Community,

I am currently developing an ASP.NET Core web application for my WorstBrands website and I'm facing some difficulties in hosting it on IIS (Internet Information Services). I have successfully published my application using Visual Studio, and now I'm trying to set up my IIS server to host it. My development environment is as follows:

  • Visual Studio 2019
  • ASP.NET Core 5.0
  • Windows Server 2019
  • IIS 10

I have followed the official Microsoft documentation for hosting ASP.NET Core applications on IIS, and I've done the following:

  1. Installed the .NET Core Hosting Bundle.
  2. Created a new website in IIS with the proper bindings and application pool settings.
  3. Pointed the website's physical path to the published output folder of my application.
  4. Ensured that the 'No Managed Code' option is selected in the application pool's .NET CLR version.

However, when I try to access my website through the browser using the server's IP address or domain, I get the following error:

mathematicaCopy code
HTTP Error 500.30 - ANCM In-Process Start Failure

I have checked the event logs, and I found this message:

sqlCopy code
Application 'MACHINE/WEBROOT/APPHOST/MY_WEBSITE' with physical root 'C:\inetpub\wwwroot\my_website\' failed to start process with commandline 'dotnet .\MyWebsite.dll', ErrorCode = '0x80004005' : 80008081.

I am not sure what's causing this error, and I have already tried the following troubleshooting steps:

  • Restarted IIS and the server.
  • Double-checked the file permissions on the published output folder.
  • Ensured that the correct version of the .NET Core Runtime is installed on the server.

Despite trying these steps, the issue persists. I would appreciate any guidance on how to resolve this error and successfully host my ASP.NET Core web application on IIS.

Thank you in advance for your assistance!

Internet Information Services
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,778 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Vahid Ghafarpour 22,430 Reputation points
    2023-04-28T02:42:22.49+00:00

    Based on the error message, it seems that the issue is related to the ANCM (ASP.NET Core Module) failing to start the .NET Core process. Here are a few additional troubleshooting steps you can try:

    Check the .NET Core version: Make sure that the .NET Core version used to build the application matches the version installed on the server. You can check the version of .NET Core used to build the application by looking at the runtimeconfig.json file located in the application's output folder.

    1. Enable detailed error messages: By default, IIS returns a generic HTTP 500 error message without providing any additional information about the underlying issue. You can enable detailed error messages by modifying the web.config file located in the root folder of your application. Add the following snippet under the <system.webServer> section:
    <aspNetCore
       stdoutLogEnabled="true"
       stdoutLogFile=".\logs\stdout"
       hostingModel="inprocess" />
    

    This will enable logging of the stdout stream to a file located in the 'logs' folder of your application.

    Check the event logs: In addition to the error message you found earlier, check the Windows Event Viewer for any additional errors or warnings related to your application.

    Check the IIS application pool identity: Make sure that the application pool identity has sufficient permissions to access the application's files and folders. You can also try changing the identity to 'LocalSystem' temporarily to see if that resolves the issue.

    Try running the application from the command line: Open a command prompt on the server and navigate to the application's output folder. Try running the command 'dotnet MyWebsite.dll' and see if any errors are displayed.

    0 comments No comments

  2. Yurong Dai-MSFT 2,841 Reputation points Microsoft Vendor
    2023-04-28T09:24:27.7633333+00:00

    Hi @Deborah Lane,

    HTTP Error 500.30 - ANCM In-Process Start Failure

    This error most often occurs when a .NET Core web application fails to start. If the application fails to start, then you cannot attach a debugger to it. The easiest way to fix this error is to republish your code, but make sure to check the option "Remove additional files at destination".

    Or you can try another way. In your .csproj file, change AspNetCoreHostingModel value from InProcess to OutProcess and re-run your application. To explicitly specify the mode in which we want the application to run, provide the following configuration in the web project .csproj file:

    <PropertyGroup>
      <TargetFramework>netcoreapp5.0</TargetFramework>
      <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
      <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
    </PropertyGroup>
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the email notification for this thread.

    Best regards,

    Yurong Dai

    0 comments No comments

  3. Bruce (SqlWork.com) 71,266 Reputation points
    2023-04-28T20:36:06.34+00:00

    the error indicates that your startup code threw an error. that is your code has a bug causing it to crash at startup. this is typically a configuration issue, often related to connectivity or permission.

    a common cause is the app tries to connect to a database or file at startup and fails. often because the app pool account does not have permission.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.