Got a RoleEnvironmentException in Azure while accessing RoleEnvironment.IsEmulated

After I deployed my ASP.NET WebRole to Azure and looked at Azure Intellitrace, I noticed a lot of RoleEnvironment exceptions, and they happen in RoleEnvironment.IsEmulated.

I thought there was something in ServiceConfiguration because the next-last call to stacktrace is always RoleEnvironment.GetConfigurationSettingValue.

Now I searched for this problem, but did not find anything but this link:

http://bretstateham.com/azure-serviceconfiguration-cscfg-changes%E2%80%A6/

But my service configuration is correct. I think customization? IsSimulationEnvironment? Azure should be created, but not in my case due to exceptions.

And I can not put "IsSimulationEnvironment"? Manual installation in my configuration because it does not match the xml namespace of the serviceconfiguration service.

Has anyone figured out how to solve this annoying problem?

+4
source share
1 answer

I think your RoleEnvironment is not yet available. those. you check RoleEnvironment.IsEmulated before initializing it ...

Try it,

while (!RoleEnvironment.IsAvailable) continue;//you can sleep sometime then continue if (RoleEnvironment.IsEmulated) { //Your code here } 
0
source

Source: https://habr.com/ru/post/1436831/


All Articles