none
Web.Config is changed (drastically) during deployment to Azure -- what's going on?

    Question

  • After deploying to Azure, I kept getting server errors -- the application would not run.  So I did a remote desktop into the instance and found that the web.config was completely overhauled...what's going on?  I thought web.config was packaged as-is?  Instead, the entire configuration has been replaced.  When I replace the "new" version with the original, unaltered, correct configuration, my app works as intended.  

    First off, what's going on here?  What am I doing wrong?  This way I can understand and not replicate this in the future.

    Secondly, how do I stop this behavior?  I want the original web.config deployed -- not some arbitrary imposter.  Thank you!

    original web.config changes drastically when deployed

    Friday, June 15, 2012 11:39 AM

Answers

  • Ahh...I found the issue based on a nugget ("Somehow the BuildAction of the web.config file got changed from Content to None") from StackOverflow. I had the same problem. After changing the BuildAction back to "Content" deployment works as expected.  Sheesh.
    • Marked as answer by dune_buggy Tuesday, June 26, 2012 5:39 AM
    Tuesday, June 26, 2012 5:39 AM

All replies

  • Web.config transformation is applied during packaging the application. Make sure that your Web.release.config does not contain unwanted transformations.

    weichhold.com

    Friday, June 15, 2012 1:02 PM
  • Thanks! But I checked that first thing. Not an issue.  Something else is happening.
    Friday, June 15, 2012 1:20 PM
  • Hi,

    Do you mean your web.config file is the original web.config and works fine in local (Azure emulator)? After you deploy on Azure VM, the web.config has been changed? Do you have ever enable RDP to connect Azure VM check it?

    I've test it at my side but can not reproduce this issue, if you do all thing but still get the same result, try to change "Copy to Output Directory" to "copy always" and have a try.

    Hope this helps.


    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

    Sunday, June 17, 2012 2:18 PM
    Moderator
  • Do you mean your web.config file is the original web.config and works fine in local (Azure emulator)? After you deploy on Azure VM, the web.config has been changed? Do you have ever enable RDP to connect Azure VM check it?

    Yes, the web.config files works find in local (Azure emulator).  But when I deploy to Azure, the web.config does not come across as the same. As mentioned in my original question, I used RDP to check.  The screenshots of the original web.config and new web.config are from RDP. As you can see, the file content is drastically different.

    If I just save the original file into the server folder (using RDP), the application works as expected on Azure.  But this is a temporary work-around, as the file goes back to the changed state on reboot or server change. I need a permanent solution.  I'm sure there's user error here (mine), but I cannot figure out what, as I'm doing everything "by the book."  

    BTW, doing a "copy always" doesn't help. 

    Tuesday, June 26, 2012 5:13 AM
  • Quick update: I unzipped the CSKPKG file created for Azure deployment (per a suggestion on StackOverflow). Now I see that in the package file, web.config is entirely missing.

    During deployment to Azure, a new, basic one must be created on the fly to replace the missing file.

    Any idea what's going on? Why does web.config go missing during the packaging process?

    Tuesday, June 26, 2012 5:17 AM
  • Ahh...I found the issue based on a nugget ("Somehow the BuildAction of the web.config file got changed from Content to None") from StackOverflow. I had the same problem. After changing the BuildAction back to "Content" deployment works as expected.  Sheesh.
    • Marked as answer by dune_buggy Tuesday, June 26, 2012 5:39 AM
    Tuesday, June 26, 2012 5:39 AM