none
Debugging in Role Enviroment

    Question

  • 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

    Thursday, July 12, 2012 11:31 AM

Answers

  • 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

    Wednesday, July 18, 2012 8:20 AM

All replies

  • 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");         }

                               

    Thursday, July 12, 2012 1:01 PM
  • Correct, since 'false == RoleEnvironment.IsAvailable'

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

    Thursday, July 12, 2012 2:55 PM
  • 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

    Friday, July 13, 2012 2:54 AM
    Moderator
  • 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


    • Edited by Nadav Rub Friday, July 13, 2012 7:31 AM
    Friday, July 13, 2012 7:29 AM
  • 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

    Wednesday, July 18, 2012 8:20 AM
  • Not sure what you mean, do you have an example?

    Marcel

    Monday, July 30, 2012 1:06 PM