dotnet / dotnet/aspnetcore

Startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup failed to execute in Azure App service.

Open
#48,442 13 comments 1 reaction 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

After updating my asp.net core app to .NET7 I get exception at startup when run in Azure App Service. I have searched and found similar issue here: https://github.com/dotnet/aspnetcore/issues/45022

Issue is closed and seem to be resolved, but mine persists.

**Exception at startup:**

**System.InvalidOperationException**
_Startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup failed to execute. See the inner exception for more details._

`System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File "RuntimeAssembly.cs", line 357, in RuntimeAssembly RuntimeAssembly.InternalLoad(AssemblyName assemblyName, ref StackCrawlMark stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, bool throwOnFileNotFound)
File "Assembly.CoreCLR.cs", line 52, in Assembly Assembly.Load(AssemblyName assemblyRef)
File "GenericWebHostBuilder.cs", line 147, in void GenericWebHostBuilder.ExecuteHostingStartups()`

The server is running without problems but this exception is always there on startup.

### Expected Behavior

I would expect no exceptions on application startup.

### Steps To Reproduce

_No response_

### Exceptions (if any)

**System.InvalidOperationException**
Startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup failed to execute. See the inner exception for more details.

**System.IO.FileNotFoundException**
Could not load file or assembly 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

### .NET Version

7.0.203

### Anything else?

Web App:

**Stack settings .NET version:** .NET7 (STS)
**Platform:** 64 Bit
**WEBSITE_PLATFORM_VERSION** : 100.0.7.203

Deployment settings:

**Target Framework:** net7.0
**Deployment Mode:** Framework-dependant
**Target Runtime:** Portable

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.