protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
string logsDir = this.GetLoggingPath();
}
private string GetLoggingPath()
{
var agentDataDirPath = Path.GetTempPath();
Trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "Role Environment is available : {0}", RoleEnvironment.IsAvailable));
// If running in Azure use default local storage
if (RoleEnvironment.IsAvailable)
{
try
{
Trace.WriteLine("Getting the agentDataDir location");
agentDataDirPath = RoleEnvironment.GetLocalResource(agentDataDirStorage).RootPath;
}
catch (RoleEnvironmentException exp)
{
throw new InvalidOperationException(exp);
}
}
return agentDataDirPath;
}
Even when my cloud service is running on azure RoleEnvironment.IsAvailable is false. My service is running on IIS 8.5 and it is running under Network Service.
Any idea what am i doing wrong here. Also when i remote in and change the web.config a bit by adding space then IIS RoleEnvironment.IsAvailable is evaluated to true.
Also i am using Azure version 2.5