Azure / Azure/app-service-linux-docs

trouble running net6 on azure app service linux

Open
#98 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
150
Forks
90
Avg merge
2m
Merged PRs (30d)
1

Description

I'm having a hard time upgrading from netcore31 to net6. The application runs fine, but when I deploy to azure I get this error in the logs:

```text
The framework 'Microsoft.NETCore.App', version '6.0.0' was not found.
- The following frameworks were found:
6.0.0-preview.3.21201.4 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
```

as best I can tell, it looks like azure is using an old docker container to run my binaries. I can see this `docker run` command in the logs, reformatted for clarity and changing app-specific names to `myapp`:

```text
docker run -d -p 9792:8080-p 5124:50050-p 3520:50051 \
--name myapp_0_5ec90755 \
-e WEBSITE_SITE_NAME=myapp \
-e WEBSITE_AUTH_ENABLED=False \
-e WEBSITE_ROLE_INSTANCE_ID=0 \
-e WEBSITE_HOSTNAME=myapp.azurewebsites.net \
-e WEBSITE_INSTANCE_ID=GUID \
-e HTTP_LOGGING_ENABLED=1 \
appsvc/dotnetcore:6.0_20210409.1 dotnet MyApp.dll
```

The [appsvc/dotnetcore:6.0_20210409.1 image](https://hub.docker.com/layers/appsvc/dotnetcore/6.0_20210409.1/images/sha256-892f91c535544499d9dbb17dd49d57cb53e96dc744849a58f5c62ebdd007b7b4?context=explore) was published on May 12th.

I guess `appsvc/dotnetcore:6.0_20210409.1` doesn't contain the release version of net6?

## Workaround

I was able to get my app working by deploying as a [self-contained application](https://docs.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained)

```diff
- dotnet publish MyApp -c Release -o myapp
+ dotnet publish MyApp -c Release -o myapp \
+ --framework 'net6.0' -r 'linux-x64' --self-contained true
```

Then I changed my azure app service Configuration -> General Settings "Startup Command" from `dotnet MyApp.dll` to `MyApp`. At this point, it doesn't matter what runtime I've selected for the app service, since I'm deploying the runtime with my application.

I would greatly prefer to leave app service in charge of the runtime, and just ship as a [framework-dependant application](https://docs.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.