Search code examples
c#iisasp.net-core-webapi.net-8.0

API not starting in IIS After Deployment: Missing .NET Hosting Components?


We deployed an ASP.NET Core 8 Web API to IIS. The API is not a self-contained deployment. The application pool was created and assigned to the application folder with Read and Read & Execute permissions, and the pool is started. The application folder also has a web.config file.

However, when we attempt to access the API through the client-side application, we never receive a response. It appears the application isn't starting, and IIS doesn't log any access to the API, though requests to the client-side code are logged successfully. The Event Viewer shows no errors or useful information.

When we manually run the application from the command line using dotnet .\<applicationName>.dll, it starts without any errors and produces logs as expected. Checking the HTTPErr logs shows requests to the API routes, but these requests are marked as canceled.

On our local and development environments, the application runs correctly. These environments have the following components installed:

  • Microsoft .NET 8.0.8 Windows Server Hosting
  • Microsoft .NET 8.0.8 Runtime (x86)
  • Microsoft .NET 8.0.8 Runtime (x64)
  • Microsoft ASP.NET Core 8.0.8 Shared Framework (x86)
  • [On the development server]: Microsoft ASP.NET Core 8.0.8 Shared Framework (x64)

However, on the production server (where the API fails to start), only the following component is installed:

  • Microsoft .NET 8.0.8 Windows Server Hosting

Could the issue be that the full .NET Hosting Bundle, including the necessary runtimes and ASP.NET Core shared frameworks, wasn't properly installed on the production server? If so, what are the necessary steps to resolve this?


Solution

  • You can go to the .NET 8 download page and download the ASP.NET Core Runtime & Hosting Bundle. after installation, verify that both the ASP.NET Core Shared Framework and .NET Runtime for x64 and x86 are installed.

    dotnet --list-runtimes
    

    Once the installation is complete, restart IIS and try again.