2011-08-26 21 views
1

在初始化包含URL中機器名稱的RavenDB文檔存儲庫時,如果指定非默認數據庫即Multitenant,則會出現錯誤。 如果我不指定默認數據庫,我只能得到store.Initialize()初始化包含URL中計算機名稱的RavenDB文檔存儲庫時出錯

我的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 

與此消息

消息= 「值不能爲空\ r \ n參數名:克」

方案

一)第一次(如果數據庫尚不存在),這就是所謂的, 調用成功,我注意到,原始的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"}} 

回答

1

您可以在連接字符串或文檔存儲屬性指定的值,而不是兩個與此同時。