小编Але*_*ков的帖子

无法在 Docker 容器、ASP.NET 6 中加载文件或程序集 Newtonsoft.Json

更新到 .NET 6 后,在 Docker 容器内运行 ASP.NET 应用程序时出现此错误:

An unhandled exception was thrown by the application.
System.IO.FileNotFoundException: Could not load file or assembly \u0027Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed\u0027. The system cannot find the file specified.  File name: \u0027Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed\u0027
at Cadmean.RPC.ASP.FunctionController.GetFunctionCall()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine]
...
Run Code Online (Sandbox Code Playgroud)

这是我的 Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app

COPY . ./

RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "DealCrackerBackend.dll"]
Run Code Online (Sandbox Code Playgroud)

库 Newtonsoft.Json 13.0.1 是来自解决方案中不同项目(类库)的引用。引用的 nuget 包 …

.net c# asp.net docker

6
推荐指数
1
解决办法
2142
查看次数

标签 统计

.net ×1

asp.net ×1

c# ×1

docker ×1