RavenDB embedded on Azure sites - access denied

I get an "Access Denied" message when I try to deploy my MVC4 site using the built-in RavenDB instance to the new Azure Website Preview feature. The site works perfectly in place.

This is how I configure Raven:

//Initialize the RavenDB Data Store Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8887); var documentStore = new EmbeddableDocumentStore() { DataDirectory = "~\\App_Data", UseEmbeddedHttpServer = true, Configuration = { Port = 8887 } }; documentStore.Initialize(); 

And here is the stack trace when I browse the site:

 Access is denied Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.NetworkInformation.NetworkInformationException: Access is denied Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NetworkInformationException (0x5): Access is denied] System.Net.NetworkInformation.SystemIPGlobalProperties.GetAllTcpConnections() +1570717 System.Net.NetworkInformation.SystemIPGlobalProperties.GetActiveTcpListeners() +74 Raven.Database.Util.PortUtil.FindPort() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Util\PortUtil.cs:110 Raven.Database.Util.PortUtil.GetPort(String portStr) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Util\PortUtil.cs:44 Raven.Database.Config.InMemoryRavenConfiguration.Initialize() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\InMemoryRavenConfiguration.cs:170 Raven.Database.Config.RavenConfiguration.LoadConfigurationAndInitialize(IEnumerable`1 values) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\RavenConfiguration.cs:28 Raven.Database.Config.RavenConfiguration..ctor() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Config\RavenConfiguration.cs:17 Raven.Client.Embedded.EmbeddableDocumentStore.get_Configuration() in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Embedded\EmbeddableDocumentStore.cs:63 Raven.Client.Embedded.EmbeddableDocumentStore.set_DataDirectory(String value) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Client.Embedded\EmbeddableDocumentStore.cs:90 Solarity.DesignSearch.Website.Bootstrapper.BuildUnityContainer() in c:\a\src\Solarity.DesignSearch\Solarity.DesignSearch.Website\Bootstrapper.cs:35 Solarity.DesignSearch.Website.Bootstrapper.Initialise() in c:\a\src\Solarity.DesignSearch\Solarity.DesignSearch.Website\Bootstrapper.cs:20 Solarity.DesignSearch.Website.MvcApplication.Application_Start() in c:\a\src\Solarity.DesignSearch\Solarity.DesignSearch.Website\Global.asax.cs:23 [HttpException (0x80004005): Access is denied] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9859725 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296 [HttpException (0x80004005): Access is denied] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 
+5
source share
2 answers

I managed to get it to work, although this is not perfect. You may notice in my original post that I am setting UseEmbeddedHttpServer = true. This means that I can go to http: [MyUrl]: 8081 and get RavendDB Management Studio so that I can view my data. For some reason, RavenDB wants to perform the same port check when this property is set in the same way as when setting the Port parameter to automatic (Port = *).

I believe that RavenDB may need to be fixed to make sure the port is configured when UseEmbeddedHttpServer is True, and also allows you to set the Configuration property in the EmbeddedDocumentStore when created.

But at the same time, you can really make your MVC4 site work with EmbeddedDocumentStore on Azure sites by simply specifying a port. In addition, you really need to use the AppSettings configuration, and not set the Configuration property in the EmbeddedDocumentStore when creating (for example, I tried to do the above). This post ( fooobar.com/questions/920727 / ... ) shows how to do this.

Unfortunately, I still have not found a way to start EmbeddedHttpServer, so I can use Raven Management Studio. If I find out how, I will post the solution here.

+3
source

Hi, this was answered by RavenDb on Azure sites - Access denied Basically you need to configure the port in Web.config

0
source

Source: https://habr.com/ru/post/920729/


All Articles