Deploying web api .net 5 to hosting failing.

NOVATROOP77 256 Reputation points

I am trying to deploy my .net 5 web api project which works fine locally in issexpress.

But when deploying to my web host whom say they support .net 5 I get the following logs with not much to go on.


The Error I am getting from the above logs. As you see its not very detailed how to do i get to the root of the issues , its a swagger api with ef core it all works locally grand.

info: Microsoft.Hosting.Lifetime[0]
Now listening on:
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\home\site\wwwroot
info: Microsoft.Hosting.Lifetime[0]
Application is shutting down...

My Web config for completeness.

<?xml version="1.0" encoding="utf-8"?>  
  <location path="." inheritInChildApplications="false">  
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />  
      <aspNetCore processPath=".\TheHockeyLabMn.WebApi.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout.txt" hostingModel="inprocess" />  
<!--ProjectGuid: c97f985a-a850-4cff-b2a0-4c3994731f1d-->  

  "ConnectionStrings": {  
    "DefaultConnection": ""  
    "AppSettings": {  
      "Secret": ""  
    "Logging": {  
      "LogLevel": {  
        "Default": "Error",  
        "Microsoft": "Warning",  
        "Microsoft.Hosting.Lifetime": "Information"  
    "AllowedHosts": "*"  

I left out my connection details for security purposes.

Added program.cs at request.

  public class Program  
        public static void Main(string[] args)  
        public static IHostBuilder CreateHostBuilder(string[] args) =>  
             .ConfigureLogging(logging =>  
                .ConfigureWebHostDefaults(webBuilder =>  
Internet Information Services
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,508 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,136 questions
{count} votes

2 answers

Sort by: Most helpful
  1. P a u l 10,406 Reputation points

    In your Program.cs are you calling Run or Start on IHost? Run will block but Start starts the host asynchronously. It sounds like you need to use Run to stop the process from immediately terminating.

  2. Bruce ( 59,306 Reputation points

    as no errors are logged, are you sure you don't have an app_offline.htm file in the root

    0 comments No comments