RavenDB.Client和NetCoreApp1.0将无法连接

时间:2016-10-19 07:44:27

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

我正在尝试在我的基于netcoreapp1.0的aspnet5应用程序中使用RavenDB 我正在运行此代码:

 IDocumentStore store = new DocumentStore()
              {
                Url = "http://localhost:8080"
              }.Initialize();
string[] databaseNames = store.DatabaseCommands.GlobalAdmin.GetDatabaseNames(1);

和我的project.json看起来像:

 "dependencies": {
    "Microsoft.NETCore.App": {
        "version": "1.0.0",
        "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel.Https": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "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.EntityFrameworkCore": "1.0.0",
    "Swashbuckle.SwaggerGen": "6.0.0-beta901",
    "Swashbuckle.SwaggerUi": "6.0.0-beta901",
    "RavenDB.Client": "3.5.0-rc-35173"
},

"frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "netstandard1.6",
        "portable-net452+win81"
      ]
    }
  }, ...

它失败并出现此异常:

Exception thrown: 'System.ArgumentNullException' in System.Private.CoreLib.ni.dll

Additional information: SafeHandle cannot be null.

这个完全相同的代码已在.net 45上测试过并且有效。任何想法为什么会这样?

1 个答案:

答案 0 :(得分:0)

通过沉默公共语言运行时异常"解决了这个问题。这是由于RavenDB中的异常处理错误引起的。即使存在内部CLR异常,它看起来也能正常工作。