是否可以在同一ASP.NET运行时容器中安装不同的ASP.NET核心框架?

发布于 2025-02-09 20:26:29 字数 1050 浏览 0 评论 0原文

我有以下dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal

COPY ./appsettings.json /icon/Server-Files/

WORKDIR /icon

COPY ./* /icon/Server-Files/
CMD [ "dotnet", "Server-Files/Server.dll" ]

我不必构建项目,因为我只使用.dll文件编译。

图像是构建并能够运行的。但是,我有一个试图在服务器中执行某些任务的客户端,并且我会遇到以下错误:

| The specified framework can be found at:
icon42test        | It was not possible to find any compatible framework version
icon42test        | The framework 'Microsoft.AspNetCore.App', version '5.0.0' (x64) was not found.
icon42test        |   - The following frameworks were found:
icon42test        |       6.0.6 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
icon42test        | 
icon42test        | You can resolve the problem by installing the specified framework and/or SDK.

有没有办法将5.0.0框架安装到容器中?我无法理解Docker Hub上可用的不同dotnet图像之间的区别代码>等。

由于我没有源代码,并且仅编译.dll文件,所以我无法理解我可能需要哪些其他框架在aspnet运行时容器中。

I have the following Dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal

COPY ./appsettings.json /icon/Server-Files/

WORKDIR /icon

COPY ./* /icon/Server-Files/
CMD [ "dotnet", "Server-Files/Server.dll" ]

I do not have to build the project because I only have compiled .dll files with.

The image is built and is able to run. However I have a client that is trying to conduct some tasks in the server and I keep getting the following error:

| The specified framework can be found at:
icon42test        | It was not possible to find any compatible framework version
icon42test        | The framework 'Microsoft.AspNetCore.App', version '5.0.0' (x64) was not found.
icon42test        |   - The following frameworks were found:
icon42test        |       6.0.6 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
icon42test        | 
icon42test        | You can resolve the problem by installing the specified framework and/or SDK.

Is there a way to install the 5.0.0 framework into the container? I am unable to comprehend the distinction between the different dotnet images available on Docker Hub e.g. aspnet, runtime-deps, runtime etc.

Since I do not have the source code and only the compiled .dll files I am unable to understand which other frameworks I might need in the aspnet runtime container.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

-残月青衣踏尘吟 2025-02-16 20:26:29

我可能已经找到了一个解决方案:

事实证明,大多数dotnet信息都存储在/usr/share/dotnet 目录中的SDKS

dockerfile 的相应容器中语法的复制< / code>可以使用以下内容将相关文件从容器图像复制到我当前的容器:

FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal

## Add the relevant SDKs to this current runtime base image

COPY --from=mcr.microsoft.com/dotnet/sdk:2.1 /usr/share/dotnet /usr/share/dotnet/
COPY --from=mcr.microsoft.com/dotnet/sdk:5.0 /usr/share/dotnet /usr/share/dotnet/

# List out the available runtimes / SDKs
CMD ["dotnet", "--list-runtimes", "dotnet", "--list-sdks"]

结果输出如下:

Microsoft.AspNetCore.All 2.1.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

现在,您有必要的Runtimes / SDK在容器中。

I might have found a solution for this:

It turns out that most of the dotnet information is stored in the /usr/share/dotnet directory within the respective containers for SDKs

Dockerfile syntax's COPY can be used in order to copy the relevant files from the container images to my current container using the following:

FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal

## Add the relevant SDKs to this current runtime base image

COPY --from=mcr.microsoft.com/dotnet/sdk:2.1 /usr/share/dotnet /usr/share/dotnet/
COPY --from=mcr.microsoft.com/dotnet/sdk:5.0 /usr/share/dotnet /usr/share/dotnet/

# List out the available runtimes / SDKs
CMD ["dotnet", "--list-runtimes", "dotnet", "--list-sdks"]

The resultant output is as follows:

Microsoft.AspNetCore.All 2.1.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Now you have the necessary runtimes / SDKs in the container.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文