【发布时间】:2019-08-25 05:08:09
【问题描述】:
问题陈述
我的一个 POC 尝试使用 AWS Lambda 函数连接 RavenDB 云服务,但连接失败。
背景
我为此使用客户端证书 (.pfx) 文件。它在使用 X509Certificate2 分配证书期间准确地引发错误。我已将证书转换为 byte[] 并通过。我使用的证书可以完全访问数据库。我包含以下错误
代码
if (_bClientCertificate != null)
{
if (_bClientCertificate.Length > 0)
{
xclientCertificate = new X509Certificate2(_bClientCertificate);
}
}
IDocumentStore store = new DocumentStore()
{
Certificate = xclientCertificate, //Error occured here
Urls = _Urls,
Database = _DBName
}.Initialize();
异常详情:
System.IO.FileLoadException
HResult=0x80131509
Message=Could not load file or assembly 'Sparrow, Version=4.2.2.0, Culture=neutral, PublicKeyToken=37f41c7f99471593'. An operation is not legal in the current state. (Exception from HRESULT: 0x80131509)
Source=Raven.Client
StackTrace:
at Raven.Client.Documents.Subscriptions.DocumentSubscriptions..ctor(IDocumentStore store) in C:\Builds\RavenDB-Stable-4.2\42017\src\Raven.Client\Documents\Subscriptions\DocumentSubscriptions.cs:line 33
at Raven.Client.Documents.DocumentStoreBase..ctor() in C:\Builds\RavenDB-Stable-4.2\42017\src\Raven.Client\Documents\DocumentStoreBase.cs:line 28
at Firecloud.DataAccess.RavenDB.SessionStore.CreateStore() in C:\Works\SourceCode\FC\Library\RavenDB\FC.DataAccess.Raven\SessionStore.cs:line 87
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
【问题讨论】:
-
你有安装包麻雀吗?
-
没有。我只安装了 RavenDB 客户端包。
-
尝试安装这个包。一旦我在运行时遇到了 raven 包丢失的类似问题,手动安装解决了这个问题
-
我不确定这个包。你能告诉我Nuget包的网址吗?
-
嗯,sparrow 似乎是 raven 的一部分,您是否尝试安装较旧的 ravendb 版本?
标签: c# microservices ravendb