RavenDB UseEmbeddedHttpServer = true "拒绝访问"错误
本文关键字:quot 拒绝访问 错误 UseEmbeddedHttpServer RavenDB true | 更新日期: 2023-09-27 17:50:12
我试图连接到我的MVC4应用程序内的嵌入式RavenDB
数据库:
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);
documentStore = new EmbeddableDocumentStore
{
ConnectionStringName = ConnectionStringName,
UseEmbeddedHttpServer = true
};
documentStore.Initialize();
如果我删除UseEmbeddedHttpServer = true
选项,它的工作,我可以正常保存和从数据库读取!但是,如果指定它通过管理工作室(localhost:8080)访问,我会在documentStore.Initialize()
中得到Access Denied
错误!
这是完整的堆栈:
[HttpListenerException (0x5): Accesso negato]
System.Net.HttpListener.AddAllPrefixes() +335
System.Net.HttpListener.Start() +680
Raven.Database.Server.HttpServer.StartListening() in c:'Builds'RavenDB-Unstable-v2.0'Raven.Database'Server'HttpServer.cs:336
Raven.Client.Embedded.EmbeddableDocumentStore.InitializeInternal() in c:'Builds'RavenDB-Unstable-v2.0'Raven.Client.Embedded'EmbeddableDocumentStore.cs:210
Raven.Client.Document.DocumentStore.Initialize() in c:'Builds'RavenDB-Unstable-v2.0'Raven.Client.Lightweight'Document'DocumentStore.cs:424
RavenDbTest.Repository.DocumentStoreHolder.get_DocumentStore() in c:'Sviluppo'RavenDbTest'RavenDbTest'RavenDbTest'Repository'DocumentStoreHolder.cs:39
RavenDbTest.Controllers.RavenController.OnActionExecuting(ActionExecutingContext filterContext) in c:'Sviluppo'RavenDbTest'RavenDbTest'RavenDbTest'Controllers'RavenController.cs:23
System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +145
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback asyncCallback, Object asyncState) +266
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +202
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag) +112
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +838303
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag) +27
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +50
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +825393
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +27
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +401
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +785498
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +146
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +166
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +27
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +343
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +12551795
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
我以管理员身份运行IIS 7.5和VS2012,并在数据库文件夹中添加了"每个人完全控制"。
我能试什么?
如果你在本地机器上托管IIS 7.5上的页面,那么你得到的错误并不取决于你是否以管理员身份运行Visual Studio。您需要以管理员身份运行您的应用程序,您可以通过设置正在运行的应用程序池配置的用户来实现。
所以去IIS管理器,点击你正在为你的应用程序使用的应用程序池,点击'高级设置…',然后在'Process Model'下,将'Identity'属性的值从默认的'ApplicationPoolIdentity'更改为自定义帐户-管理员。
一般来说,我建议只在单元测试中使用EmbeddableDocumentStore(当然是在'InMemory'模式下运行),对于应用程序-将RavenDB配置为作为Windows服务运行