Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在docker容器内运行的Identity Server 4异常:无法加载DLL';System.Security.Cryptography.Native.OpenSsl';_C#_Docker_Asp.net Core_Identityserver4_.net Core - Fatal编程技术网

C# 在docker容器内运行的Identity Server 4异常:无法加载DLL';System.Security.Cryptography.Native.OpenSsl';

C# 在docker容器内运行的Identity Server 4异常:无法加载DLL';System.Security.Cryptography.Native.OpenSsl';,c#,docker,asp.net-core,identityserver4,.net-core,C#,Docker,Asp.net Core,Identityserver4,.net Core,我正在尝试让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 f

我正在尝试让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)
DockerFile

FROM microsoft/dotnet:latest
WORKDIR /app
ENV ASPNETCORE_URLS http://*:80
EXPOSE 80
ENTRYPOINT ["dotnet", "Identity.dll"]
COPY . /app
Project.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上的相关问题:

完整的.NET框架/Mono目标还是.NET核心?如果是Mono,请确保您的docker映像基于安装了Mono 4.6的映像。我使用的是Microsoft/dotnet core映像,我相信它使用.NET core添加了整个project.json作为参考。我如何确定哪个包版本与哪个.NET版本配套?我在Mac电脑上使用Visual Studio代码。您甚至有1.0.0-rc-final LOL。如果您想以1.1.0为目标:移动依赖项(包括Microsoft.NetCore.App)中的所有软件包,但浏览器链接到1.1.0-preview。浏览器链接应为:14.1.0-preview1-final。目标是netcoreapp1.1。工具中的包应为:1.0.0-preview3-final。一般来说,我认为在有主要/次要版本的地方,所有版本都是内联的。对于补丁版本,软件包可能因补丁版本而异。很抱歉,上面的说明不清楚,例如project.json中没有引用1.0.0-rc-final。我可以看到:“Microsoft.AspNet.Http.Abstractions”:“1.0.0-rc1-final”,