gpt4 book ai didi

RavenDB 嵌入 Azure 网站 - 拒绝访问

转载 作者:行者123 更新时间:2023-12-04 20:48:47 26 4
gpt4 key购买 nike

当我尝试将带有 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

最佳答案

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

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

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

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

关于RavenDB 嵌入 Azure 网站 - 拒绝访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13033305/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com