5

当我尝试将带有 RavenDB 嵌入式实例的 MVC4 站点部署到新的 Azure 网站预览功能时,我收到拒绝访问消息。该网站在本地运行良好。

这是我配置 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();

这是我浏览到该站点时的堆栈跟踪:

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
4

2 回答 2

3

我设法让它工作,虽然它并不理想。您可能会在我的原始帖子中注意到我正在设置 UseEmbeddedHttpServer = true。这样我就可以浏览到 http:[MyUrl]:8081 并获取 RavendDB Management Studio 以便我可以浏览我的数据。出于某种原因,RavenDB 希望在设置此属性时执行与将端口设置设置为自动 (Port=*) 时相同的端口检查。

我相信 RavenDB 可能需要修复,以便在 UseEmbeddedHttpServer 为 True 时支持端口设置,并且还允许您在创建时设置 EmbeddedDocumentStore 的 Configuration 属性。

但与此同时,您可以真正让您的 MVC4 站点与 Azure 网站上的 EmbeddedDocumentStore 一起使用,只需指定一个端口即可。此外,您确实必须使用 AppSettings 配置,而不是在创建时设置 EmbeddedDocumentStore 的 Configuration 属性(就像我在上面尝试做的那样)。这篇文章 ( stackoverflow.com/questions/11529159/ ) 展示了如何做到这一点。

不幸的是,我仍然没有找到运行 EmbeddedHttpServer 的方法,因此我可以使用 Raven Management Studio。如果我弄清楚如何,我会在这里发布一个解决方案。

于 2012-10-24T15:11:35.440 回答
0

嗨,这已在 Azure 网站上的 RavenDb 上得到回答 - 拒绝访问 基本上您需要在 Web.config 中配置端口

于 2012-10-24T01:58:10.010 回答