RavenDb on Azure Websites - Access Denied RavenDb on Azure Websites - Access Denied azure azure

RavenDb on Azure Websites - Access Denied


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();

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.

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;dr

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>