Environment.GetEnvironmentVariable(“RoleRoot”) returning null when called in a WebRole
I have a method (in a separated class library) which is called by a WebRole and a WorkerRole. This method contains the path of a file, which is returned using Environment.GetEnvironmentVariable("RoleRoot") , as follows: private string FooPath() { string appRoot = Environment.GetEnvironmentVariable("RoleRoot"); return Path.Combine(appRoot + @"\", @"approot\file.foo"); } When I call this method from a WorkerRole the path is returned normally. But when I call it from a WebRole I get null . Any ideas? EDIT: I am using APNS-Sharp to send push messages to iOS and it requires a .p12 certificate in