Reputation: 13116
I'm trying to connect to an embedded RavenDB
database inside my MVC4 application this way:
NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);
documentStore = new EmbeddableDocumentStore
{
ConnectionStringName = ConnectionStringName,
UseEmbeddedHttpServer = true
};
documentStore.Initialize();
if I remove UseEmbeddedHttpServer = true
option it works and I can normally save and read from database! But if specify it to access via Management Studio (localhost:8080) I get an Access Denied
error in documentStore.Initialize()
!
this is the full stack:
[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
I run IIS 7.5, VS2012 as Administrator and I added "Everyone full control" to database folder.
What I can try?
Upvotes: 1
Views: 1925
Reputation: 349
If you are hosting your page on IIS 7.5 on your local machine, then the error you're getting does not depend on whether you run Visual Studio as admin or not. You need to run your application as Administrator, and you can do it by setting up the user on which application pool your application is configured for is running.
So go to IIS Manager, click on the application pool you're using for your app, click 'Advanced Settings...' and then under 'Process Model' change the value for 'Identity' property from default 'ApplicationPoolIdentity' to custom account - Administrator in your case.
And in general, I'd suggest using EmbeddableDocumentStore for unit tests only (of course run in 'InMemory' mode) and for the applications - configure RavenDB to run as a Windows service.
Upvotes: 1