RavenDb在Azure网站 - 拒绝访问 [英] RavenDb on Azure Websites - Access Denied

查看:286
本文介绍了RavenDb在Azure网站 - 拒绝访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的新网站玩耍功能部件在Azure上,并试图获得在嵌入式模式RavenDB运行MVC的网站。一切正常,但在本地运行在Azure中部署的网站,我得到这个错误:

I'm playing around with the new Websites feature on Azure and trying to get an MVC site running with RavenDB in embedded mode. Everything works fine locally but running the deployed site in azure I get this error:

System.Net.NetworkInformation.NetworkInformationException:访问被拒绝

System.Net.NetworkInformation.NetworkInformationException: Access is denied

这发生在我创建数据库实例在Global.asax中:

This happens when I create the db instance in global.asax:

Store = EmbeddableDocumentStore { ConnectionStringName = "RavenDb" };

我的连接字符串是:

My connection string is:

<add name="RavenDb" connectionString="DataDir=~\App_Data\Raven" />

谢谢!

推荐答案

当不RavenDb指定端口,将走出去,试图找到它自己,它通过调用的 IPGlobalProperties.GetActiveTcpListeners()做到这一点

When a port is not specified for RavenDb it will go out and attempt to find it's own, it does this by calling IPGlobalProperties.GetActiveTcpListeners().

RavenDb | PortUtil.cs

var activeTcpListeners = IPGlobalProperties
                         .GetIPGlobalProperties()
                         .GetActiveTcpListeners();

调用<一个href=\"http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipglobalproperties.getactivetcplisteners.aspx\">GetActiveTcpListeners()实习生调用Win32函数的 GetTcpTable()它试图列举所有可能的端口组合的主机上。由于显而易见的原因,它不会是一个很好的方案,让乡亲到Windows Azure网站中做端口扫描。这意味着在 GetTcpTable 操作失败,当事情发展的世界,我们失败抛出异常。

Calling GetActiveTcpListeners() intern calls the Win32 function GetTcpTable() which attempts to enumerate all of the possible port combinations on the host. For obvious reasons, it would not be a good scenario to allow folks to do port scanning within Windows Azure Web Sites. Which means the GetTcpTable operation fails and when something fails in the world of development we throw an exception.

在这种特殊情况下例外是<一个href=\"http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinformationexception.aspx\">NetworkInformationException这是提高尽到安全权限忽略调用的 GetTcpTable 。这就是为什么它会导致拒绝访问的消息。

In this particular case the exception is a NetworkInformationException which is raised do to the security permissions neglecting the call to GetTcpTable. This is why it results in an Access Denied message.

TL;博士

添加一个默认的端口,以你的web.config的AppSettings部分:

Add a default port to your web.config appsettings section:

 <appSettings> 
    <add key="Raven/Port" value="*"/> <!-- Add real tcp port # -->
    <add key="Raven/DataDir" value="~\Data"/> 
    <add key="Raven/AnonymousAccess" value="Get" /> 
 </appSettings> 

这篇关于RavenDb在Azure网站 - 拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆