Answered Debugging in Role Enviroment

  • יום חמישי 12 יולי 2012 11:31
     
     

    Hi,

    I am implementing an Azure application,

    1. I use SQL Azure for authentication using the MembershipProvider.
    2. I use BLOB Tables for session states.

    in the '.cscfg' of my WebRole file I have DataConnectionString for my MembershipProvider.

    I want to be able to locally debug the application while using SQL Azure for membership authentication.

    I would rahter avoid duplicating all of the '.cscfg' info into my web.comfig, is there any way to read the information directly from the '.cscfg' file ?

    ~Nadav


    Nadav Rubinstein, See my Blog @ http://www.sophin.com

כל התגובות

  • יום חמישי 12 יולי 2012 13:01
     
      קוד כלול

    Hi Nadav,

    When you mean read directly from the config, are you not able to read it using :

            

    protectedvoid Page_Load(object sender, EventArgs e)         {             ///THis reads from the cscfg///var connstr =             RoleEnvironment.GetConfigurationSettingValue("dataconnection");         }

                               

  • יום חמישי 12 יולי 2012 14:55
     
     
    Correct, since 'false == RoleEnvironment.IsAvailable'

    Nadav Rubinstein, See my Blog @ http://www.sophin.com

  • יום שישי 13 יולי 2012 02:54
    מנחה דיון
     
     
    You can't. The cscfg file is not visible to your web role project. But SQL Azure connection string and ASP.NET membership configurations are always stored in web.config. You can't store them in cscfg. So you don't need to duplex the settings.

    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

  • יום שישי 13 יולי 2012 07:29
     
     
    My 'DataConnectionString' was setup @ the '.cscfg' file, moving it to the web.config resolved the problem as U have mentioned, however, for sessions I an using Azure Blob tables by specifying a custom 'sessionState' provider, the custom provider attributes ARE SPECIFIED in the '.cscfg' file, eg. <Setting name="allowInsecureRemoteEndpoints" value="true" />, since role is not loaded I have had to add these to the web.config as-well, and thus, I have added '/configuration/sessionState/providers/add/@allowInsecureRemoteEndpoints' attr, this worked great, however, when I have added '/configuration/sessionState/providers/add/@mediaContainerName' website startup failed with 'Unrecognized attribute: mediaContainerName', this, is specific to the mediaContainerName attr, are there any pre-defined set of attrs supported by the '/configuration/sessionState/providers/add' node of a custom sessionState provider ? why does my web site fails to load ?

    Nadav Rubinstein, See my Blog @ http://www.sophin.com


    • נערך על-ידי Nadav Rub יום שישי 13 יולי 2012 07:31
    •  
  • יום רביעי 18 יולי 2012 08:20
     
     תשובה

    Hi Nadav,

    You say it is a Windows Azure application. But when you run it local, you select the website and you do debug->new instance to launch the website?

    Why aren't you running the Windows Azure application in your local Windows Azure Compute Emulator?

    In case of the first, the WebRole in the solution acts as a normal Website and does not have any understanding of the cscfg file whatsoever. In the second case, it is a local running Windows Azure application which is aware of the cscfg file.

    Just curious.

    Marcel

  • יום שני 30 יולי 2012 13:06
     
     

    Not sure what you mean, do you have an example?

    Marcel