question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker container not working for blazor server app after upgrade to pre7

See original GitHub issue

Docker container not working for blazor server app after upgrade to pre7

After upgrading an existing blazor server app to preview7 from preview6, the docker container version does not run and fails with the following error message. The container is created, but run in debug failed with this message:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '3.0.0-preview7.19365.7' was not found.
  - The following frameworks were found:
      3.0.0-preview6.19307.2 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]

When running docker version in release mode, I see in the console log that still preview6 files are loaded:

[...]
Microsoft.Hosting.Lifetime: Information: Now listening on: https://

Microsoft.Hosting.Lifetime: Information: Now listening on: http://

      Application started. Press Ctrl+C to shut down.
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.

      Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Hosting environment: Development

      Content root path: /app
Microsoft.Hosting.Lifetime: Information: Content root path: /app
"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.0.0-preview6-27804-01/System.Net.Security.dll" wurde geladen. Das Laden von Symbolen wurde übersprungen. Das Modul ist optimiert, und die Debugoption "Nur eigenen Code" ist aktiviert.
"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.0.0-preview6-27804-01/System.Collections.NonGeneric.dll" wurde geladen. Das Laden von Symbolen wurde übersprungen. Das Modul ist optimiert, und die Debugoption "Nur eigenen Code" ist aktiviert.
"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.0.0-preview6-27804-01/System.Runtime.Intrinsics.dll" wurde geladen. Das Laden von Symbolen wurde übersprungen. Das Modul ist optimiert, und die Debugoption "Nur eigenen Code" ist aktiviert.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 GET https://localhost:44356/  
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/2 GET https://localhost:44356/  
"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.0.0-preview6-27804-01/System.Security.Principal.dll" wurde geladen. Das Laden von Symbolen wurde übersprungen. Das Modul ist optimiert, und die Debugoption "Nur eigenen Code" ist aktiviert.
"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.0.0-preview6-27804-01/System.ComponentModel.Annotations.dll" wurde geladen. Das Laden von Symbolen wurde übersprungen. Das Modul ist optimiert, und die Debugoption "Nur eigenen Code" ist aktiviert.
[...]

latest Visual Studio Preview .net SDK has been installed and dependencies have been upgraded to preview7 nuget packages. App is running fine as .net core and IIS, but not with docker from visual studio. Worked with preview6 without any problem.

Here is my local dotnet --info:


.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview7-012821
 Commit:    6348f1068a

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview7-012821\

Host (useful for support):
  Version: 3.0.0-preview7-27912-14
  Commit:  4da6ee6450

.NET Core SDKs installed:
  2.1.503 [C:\Program Files\dotnet\sdk]
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.604 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  2.1.800-preview-009696 [C:\Program Files\dotnet\sdk]
  2.1.800 [C:\Program Files\dotnet\sdk]
  2.2.300 [C:\Program Files\dotnet\sdk]
  2.2.400-preview-010219 [C:\Program Files\dotnet\sdk]
  2.2.400 [C:\Program Files\dotnet\sdk]
  3.0.100-preview7-012821 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview7.19365.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

How to reproduce

The same happens with a fresh project from an included template:

  • Using the balzor server app template
  • add docker support in visual studio
  • run the app via docker from visual studio

###dockkerfile for template from balzor server project

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["WebApplication3test/WebApplication3test.csproj", "WebApplication3test/"]
RUN dotnet restore "WebApplication3test/WebApplication3test.csproj"
COPY . .
WORKDIR "/src/WebApplication3test"
RUN dotnet build "WebApplication3test.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "WebApplication3test.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplication3test.dll"]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
whentotradecommented, Jul 28, 2019

I was able to solve the error by updating the created dockerfile manully to pull the correct images:

Changed: FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base

To: FROM mcr.microsoft.com/dotnet/core/aspnet:3.0.0-preview7-buster-slim AS base

and

Changed: FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build

To: FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview7-buster AS build

Not sure why I needed to change these tags in the dockerfile from the template but afterwars the error is gone.

1reaction
mikesisticommented, Dec 11, 2019

@Kavinci’s solution fixed the problem for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker container not working for blazor server app after ...
I ran into this issue as well and this is how I resolved it. For anyone stumbling upon this problem, the template has...
Read more >
Problem with running my app from container
Hi there For my Blazor (.NET 5) app I created a container by docker run -p 52115:5000 blazordockerapp I can see it is...
Read more >
Blazor css is not applied in Docker
I have a problem with a Blazor app and Docker. In debug, no problem with the css, but when I put the application...
Read more >
Docker blazor server. cshtml add. … For instructions on how
Can't access Blazor app in Docker container - always listening on ... blazor; Docker container not working for blazor server app after upgrade...
Read more >
Containerising a Blazor Server App
In this post, I give an introduction to Docker and some of its key concepts. Then show you how to containerise a Blazor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found