The type initializer for '<Module>' threw an exception. at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment. RRS feed

  • Question

  • The type initializer for '<Module>' threw an exception.    at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName)

       at Microsoft.OrderManagementService.AzureStorage.GetCouldBlobContainer()


    We have a WCF service hosted in web role. We are running in Full IIS mode.


    1.        We tried registering assemblies in the Azure GAC.

    2.        We tried “useLegacyV2RuntimeActivationPolicy” in the web.config file.

    3.  We tried setting the below in Application_Start of Global.asax


    CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSettingPublisher) =>


                        var connectionString = RoleEnvironment.GetConfigurationSettingValue(configName);




    Thanks in advance

    Tuesday, July 12, 2011 9:40 AM

All replies

  • Hi Cpsingh,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.


    Wenchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Wednesday, July 13, 2011 5:26 AM
  • Hi Cpsingh,


    Does your application work fine in computer emulator and the issue only happen on Windows Azure? If you reference any assembly that is no originally installed on Azure VM, please make sure you set “Copy Local” = True for the assembly so it will be included in the package. To troubleshot the issue, you can enable RDP as documented below:



    Once you logged into the VM, please check event log to see if there is any more inforamtion about the exception, or attach a debugger to the application process to see what happens. If you requires a more in-depth level of support so Microsoft can help you further troubleshoot the issue, please visit the below link and check “Platform and Developer Support” section to see the various support options that are available to better meet your needs.



    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thanks & Regards,
    Leon Zhang
    Microsoft Online Community Support


    • Proposed as answer by Wenchao Zeng Tuesday, July 19, 2011 7:32 AM
    Thursday, July 14, 2011 7:26 AM