Problem with Protected Configuration Provider on Azure

Answered Problem with Protected Configuration Provider on Azure

  • Wednesday, July 04, 2012 10:20 AM
     
     

    I build the application for Protected Configuration Provider by help of following link.

    http://msdn.microsoft.com/en-us/library/33ws57y0.aspx

    in this example we need to add following code in web.config

    <configuration>
       <configProtectedData>
         <providers>
           <add name="TripleDESProvider"
          type="Samples.AspNet.ProtectedConfiguration.TripleDESProtectedConfigurationProvider,
                      TripleDESProtectedConfigurationProvider,
                      Version=0.0.0.0, CultureInfo=neutral,
                      PublicKeyToken=a5a9eb4fc5306403,
                      processorArchitecture=MSIL"
                keyFilePath="c:\WebSites\SampleApplication\App_Data\Keys.txt" />
         </providers>
       </configProtectedData>
    </configuration>

    its work fine in local matchine but now I want to deploy my application on azure as web role. So my question is that how can I specify path  for "Keys.txt" if I add this file in my web application? somehow "~\keys.txt" is not working. If I using "~" sign for root path, In case of IIS it return following error

    Could not find file 'c:\windows\system32\inetsrv\Keys.txt (got same kind of error on Azure)

    So "~" did not take application directory. I also try to set value for keyFilePath attribute on run time by editing web.config file, its work fine on local machine but on Azure its give me following  error

     Access to the path 'E:\sitesroot\0\web.config' is denied

    So is there any alternate way so I can use Protected Configuration Provider on Windows Azure?


All Replies

  • Thursday, July 05, 2012 3:15 AM
    Moderator
     
     

    Hi,

    Do you use Cloud Service or Virtual Machine host your application?

    As far as i know, if you use Cloud Service (web role), the Windows Server system was not installed in disk C , you can use remote desktop to connect to the Azure VM to confirm it.

    If you use Virtual Machine this path may works because OS is install in disk C.

    Another thing is i why do you want to encrypt web.config file in Windows Azure VM? Because no one can connect the VM unless he has the remote desktop permission (username/password).

    BR,

    Arwind


    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

  • Thursday, July 05, 2012 5:59 AM
     
     

    Yes Arwind, my application installed on E drive. but still give error Access to the path 'E:\sitesroot\0\web.config' is denied


  • Thursday, July 05, 2012 6:03 AM
     
     Answered

    I found the article which say that protected configuration providers do not work as such on Windows Azure. Please check following link

    http://archive.msdn.microsoft.com/pkcs12protectedconfg

    This link also come with the solution and its work fine.

    • Marked As Answer by Atul Bhavasar Thursday, July 05, 2012 6:04 AM
    •