dotnet / dotnet/aspnetcore

Benign exception in `KestrelServerImpl.BindAsync` when running a default .NET 7 website on Azure App Service (linux)

Open
#47,915 3 comments 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Created a new ASP.NET Core web service project with .NET 7, deployed to an Azure App Service (Linux), there was an exception call stack in the Log Stream in Azure Portal for the app service:

```
/home/LogFiles/2023_default_docker.log (https://******.scm.azurewebsites.net/api/vfs/LogFiles/2023_04_26_****_default_docker.log)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at Web.Service.Program.Main(String[] args) in D:\a\1\s\src\Web.Service\WebServiceProgram.cs:line 56
/opt/startup/startup.sh: line 19: 76 Aborted (core dumped) dotnet "Web.Service.dll"
```

This is not local development, but after deploying to the Azure App Service. The exception seems to be benign (the api route `/api/mycontroller` works fine and returns results). However requesting the main page shows a blank screen in the browser (as expected).

It is misleading to see this call stack in the logs. Also docker seems to be involved (how did Docker come into picture?)

Is this some spurious error/exception that can be cleaned up?

The impact of this is that unexperienced users may forget to check if the API works (`https://mysite.azurewebsites.net/api/mycontroller`), they instead check the root URL (`https://mysite.azurewebsites.net`), see it doesn't work, and spend a few hours tearing their hair out chasing red herrings around https, SSL, certificates, etc. when everything was working all along.

### Expected Behavior

Default web site for .NET 7 deployed to Azure App Service should not print any exceptions to the logs.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

.NET 7 on Azure App Service

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.