我试图在Windows Azure上使用RavenDb设置网站。
我首先设置了一个虚拟机并在其上启动了RavenDb。使用IIS和Windows身份验证进行配置。我按照here进行了配置,一切正常。我创建了一个端点,并且能够从虚拟机的URL访问数据库。
接下来,我尝试在Visual Studio中运行时从我的应用程序访问数据库。我尝试过的连接字符串类似于:
<add name="RavenDB" connectionString="Url=http://myRavenApp.cloudapp.net/;
Database=MyDatabase; Domain=myRavenApp; User=RavenDbUser; Password=password" />
和
<add name="RavenDB" connectionString="Url=http://myRavenApp.cloudapp.net/;
Database=MyDatabase; User=myRavenApp\RavenDbUser; Password=password" />
两个连接字符串都有效,我的应用程序就像魅力一样。
然后我在Azure中创建了一个网站并在其上部署了我的应用程序。当我这样做但我的应用程序开始抛出
[Win32Exception (0x80004005): The handle specified is invalid]
System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatus& statusCode) +6089632
System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob) +68
System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) +6176993
System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials) +17
System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials) +259
System.Net.AuthenticationState.AttemptAuthenticate(HttpWebRequest httpWebRequest, ICredentials authInfo) +159
System.Net.HttpWebRequest.CheckResubmitForAuth() +222
System.Net.HttpWebRequest.CheckResubmit(Exception& e) +223
[WebException: The remote server returned an error: (401) Unauthorized.]
System.Net.HttpWebRequest.GetResponse() +6115603
Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse) +233
Raven.Client.Connection.HttpJsonRequest.ReadResponseString() +776
Raven.Client.Connection.HttpJsonRequest.ExecuteRequest() +29
Raven.Client.Connection.ServerClient.DirectPutIndex(String name, String operationUrl, Boolean overwrite, IndexDefinition definition) +464
Raven.Client.Connection.<>c__DisplayClass3b.<PutIndex>b__3a(String operationUrl) +77
Raven.Client.Connection.ServerClient.TryOperation(Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result) +225
Raven.Client.Connection.ServerClient.ExecuteWithReplication(String method, Func`2 operation) +824
Raven.Client.Connection.ServerClient.PutIndex(String name, IndexDefinition definition, Boolean overwrite) +185
Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands databaseCommands, DocumentConvention documentConvention) +101
Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDatabaseCommands databaseCommands, DocumentConvention conventions) +154
Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) +71
Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly assemblyToScanForIndexingTasks, IDocumentStore documentStore) +115
Property.Base.DocumentManager.Initalize() +151
Property.Web.MvcApplication.Application_Start() +177
所以我尝试了上面提到的两个连接字符串和其他几个连接字符串,它总是这样。如果我尝试从Management Studio或我的Visual Studio在调试时访问它,我可以访问服务器,但是当我在Azure网站上部署时,我收到此错误。
如果有人知道如何解决这个问题,我将非常感激。