gpt4 book ai didi

c# - 在 docker 容器异常 : Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl' 中运行的身份服务器 4

转载 作者:行者123 更新时间:2023-11-30 12:56:37 24 4
gpt4 key购买 nike

我试图让 Identity Server 4 在 docker 容器中与 ASP.NET Core 一起运行,但我不断收到以下异常

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at Interop.Crypto.GetMaxMdSize()
at Interop.Crypto..cctor()
--- End of inner exception stack trace ---
at Interop.Crypto.GetRandomBytes(Byte[] buf, Int32 num)
at System.Security.Cryptography.RNGCryptoServiceProvider.GetBytes(Byte[] data)
at IdentityModel.CryptoRandom.CreateUniqueId(Int32 length)
at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensions.SetTemporarySigningCredential(IIdentityServerBuilder builder)
at Microsoft.Extensions.DependencyInjection.IdentityServerServiceCollectionExtensions.AddDeveloperIdentityServer(IServiceCollection services)
at Identity.Startup.ConfigureServices(IServiceCollection services)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.Internal.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection exportServices)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Identity.Program.Main(String[] args)

Docker文件

FROM microsoft/dotnet:latest
WORKDIR /app
ENV ASPNETCORE_URLS http://*:80
EXPOSE 80
ENTRYPOINT ["dotnet", "Identity.dll"]
COPY . /app

项目.json

{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",
"CassandraCSharpDriver": "3.1.0-beta1",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.AspNetCore.Cors": "1.1.0-preview1-final",

"Core.Data.Cassandra": "0.1.0",
"IdentityServer4": "1.0.0-rc2"
},

"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},

"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},

"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},

"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},

"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config",
"Dockerfile.debug",
"Dockerfile",
"docker-compose.debug.yml",
"docker-compose.yml"
]
},

"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},

"tooling": {
"defaultNamespace": "Identity"
}
}

最佳答案

我相信这是因为您混合了 1.0.x、1.1.0 包和 1.0.0 运行时。在任何地方都使用 1.0.x 或 1.1.0(并相应地定位 netcoreapp1.0 或 netcoreapp1.1)。 github上的相关问题:https://github.com/dotnet/corefx/issues/12517

关于c# - 在 docker 容器异常 : Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl' 中运行的身份服务器 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40307340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com