asp.net核心1.1 WCF客户端导致整个应用程序崩溃

时间:2016-11-18 16:18:01

标签: asp.net-core asp.net-core-1.1

我有一个包含几个WCF客户端的PCL。下面是project.json:

 "dependencies": {
    "NETStandard.Library": "1.6.1",
    "Newtonsoft.Json": "9.0.1",
    "System.ComponentModel.Annotations": "4.3.0",
    "System.Net.Http": "4.3.0",
    "System.Reflection": "4.3.0",
    "System.ServiceModel.NetTcp": "4.3.0",
    "System.ServiceModel.Primitives": "4.3.0"
},
  "frameworks": {
      "netstandard1.4": {}
}

使用asp.net core 1.0.1一切顺利,但是在我的asp.net核心项目中升级所有内容后,我的wcf客户端所做的所有调用都会失败并出现可怕的错误:

An unhandled exception of type 'System.ExecutionEngineException' occurred in System.Private.CoreLib.ni.dll

我的asp.net核心应用程序的project.json是这样的:

{
 "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Razor.Tools": {
         "version": "1.1.0-preview4-final",
          "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
},

"tools": {
    "BundlerMinifier.Core": "2.2.306",
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
},

"frameworks": {
   "netcoreapp1.1": {
    "dependencies": {
      "Microsoft.NETCore.App": {
        "type": "platform",
        "version": "1.1.0"
    },
    "MySharedProject": {
      "target": "project"
    }
  },
  "imports": [
    "netstandard"
  ]
}
},
}

如果我将所有内容保持不变,只需将Microsoft.NETCore.App上的版本更改为1.0.1就可以了。我在VS输出窗口中看到的最后一件事是调用加载System.Xml.XmlDocument包。然后就崩溃了。

1 个答案:

答案 0 :(得分:0)

这是.NET Core 1.1的已知问题:https://github.com/dotnet/core/blob/master/release-notes/1.1/1.1-known-issues.md#systemexecutionengineexception-in-systemsecuritycryptographyx509cerificatesdll-on-windows

  

解决方法:设置环境变量COMPlus_ReadyToRunExcludeList = System.Security.Cryptography.X509Certificates