初始化 URL 中包含计算机名的 RavenDB 文档存储时出错

发布于 2024-12-01 21:49:59 字数 1516 浏览 0 评论 0原文

在初始化 URL 中包含计算机名的 RavenDB 文档存储并指定非默认数据库(即多租户)时,我收到错误。 如果我不指定默认数据库,我只能让 store.Initialize() 工作。

我的 ConnectionString 是 http://somemachinename:8080;ResourceManagerId=d5723e19-92ad-4531-adad-8611e6e05c8b

以下代码失败

var store = new DocumentStore
{
    ConnectionStringName="RavenDB,
    DefaultDatabase="TNW_Grc_CLient",
    EnlistInDistributedTransactions=false
}
store.Initialize(); // fails with the following exception

并显示此消息

Message =“值不能为空。\r\n参数名称:g”

场景

a) 第一次(如果数据库尚不存在)调用此方法, 调用成功,我注意到原始 http 响应是:

HTTP/1.1 201 Created
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Location: /docs/Raven/Databases/TNW_Grc_Client
Server: Microsoft-HTTPAPI/2.0
Raven-Server-Build: 427
Date: Fri, 26 Aug 2011 19:45:23 GMT
X-Charles-Received-Continue: HTTP/1.1 100 Continue
Expires: 0
Cache-Control: no-cache

{"Key":"Raven/Databases/TNW_Grc_Client","ETag":"00000000-0000-0300-0000-000000000001"}

b) 第二次调用失败。调试一些,似乎 etag 标头不是从 服务器但客户端代码以某种方式期望:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Server: Microsoft-HTTPAPI/2.0
Raven-Server-Build: 427
Date: Fri, 26 Aug 2011 19:48:10 GMT
Expires: 0
Cache-Control: no-cache

{"Id":null,"Settings":{"Raven/DataDir":"~\\Tenants\\TNW_Grc_Client"}}

I get an error when initializing a RavenDB documentstore that contains a machinename in the URL, combined with specifying a non default database i.e Multitenant.
I can only get store.Initialize() to work if I do not specify a default database.

My ConnectionString is http://somemachinename:8080;ResourceManagerId=d5723e19-92ad-4531-adad-8611e6e05c8b

Following code fails

var store = new DocumentStore
{
    ConnectionStringName="RavenDB,
    DefaultDatabase="TNW_Grc_CLient",
    EnlistInDistributedTransactions=false
}
store.Initialize(); // fails with the following exception

with this message

Message = "Value cannot be null.\r\nParameter name: g"

Scenario:

a) The first time (if the database does not yet exist) this is called,
the call succeeds and I note that the raw http response is:

HTTP/1.1 201 Created
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Location: /docs/Raven/Databases/TNW_Grc_Client
Server: Microsoft-HTTPAPI/2.0
Raven-Server-Build: 427
Date: Fri, 26 Aug 2011 19:45:23 GMT
X-Charles-Received-Continue: HTTP/1.1 100 Continue
Expires: 0
Cache-Control: no-cache

{"Key":"Raven/Databases/TNW_Grc_Client","ETag":"00000000-0000-0300-0000-000000000001"}

b) The second time the call fails. Debugging some, it appears the etag header is not sent from
the server but is somehow expected by the client code:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Server: Microsoft-HTTPAPI/2.0
Raven-Server-Build: 427
Date: Fri, 26 Aug 2011 19:48:10 GMT
Expires: 0
Cache-Control: no-cache

{"Id":null,"Settings":{"Raven/DataDir":"~\\Tenants\\TNW_Grc_Client"}}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等风来 2024-12-08 21:49:59

您可以在连接字符串或文档存储属性上指定值,但不能同时指定两者。

You can specify values on the connection string or on the document store properties, not both at the same time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文