« Previous Next »

Thread: how to update web.config

Last post 05-17-2009 2:21 PM by WorkerBee2. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 05-07-2009, 10:11 AM

    how to update web.config

    Hi,

    I followed the instructions at http://learn.iis.net/page.aspx/578/application-packaging-guide-for-the-windows-web-application-gallery/. Everything works except updating the web.config.

    I have the following structure in my zip file

    nService4.zip
        nService4/
            a bunch of .aspx
            Web.Config
        Manifest.xml
        Parameter.xml
        install.sql
    
    Parameter.xml:
        
        <parameter
          name="Connection String For Config"
          description="Automatically sets the connection string for the Web.config."
          defaultValue="Data Source={Database Server};Database={Database Name};Uid={Database Username};Pwd={Database Password};"
          tags="Hidden">
          <parameterEntry
            type="XmlFile"
            scope="\\Web.Config$"
            match="//connectionStrings/add/@connectionString" />
        </parameter>
    

    Web.Config was not updated. I suspect it has to do with the scope syntax. Can it get to nSerive4/Web.Config in my case?

  • 05-08-2009, 11:39 PM In reply to

    Re: how to update web.config

    The deployment tool did touch the Web.Config. It changed the "add" tag from two lines to one line but it didn't update the connectionString.

    web.config
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
        <connectionStrings>
            <add name="MainDatabase" providerName="System.Data.SqlClient"
                 connectionString="Server=localhost\SQLEXPRESS;Database=nService4;Trusted_Connection=Yes;" />
        </connectionStrings>
    
    Does anyone know what is going on? Thanks!
  • 05-09-2009, 3:56 PM In reply to

    Re: how to update web.config

    Can you try removing the xmlns from your web.config root element. Then try to see if the transformation happens right. There might be some bugs relating to non default namespaces that you're hitting.
  • 05-14-2009, 10:46 PM In reply to

    Re: how to update web.config

    I am hesitant to remove the xmlns because that is added by Visual Studio. All ASP.NET applications have that. Thanks for your advice anyway.

    Can someone confirm that the installer does work with ASP.NET applications that need connection strings updated during deployment?

  • 05-15-2009, 2:10 AM In reply to

    Re: how to update web.config

    Yes, the installer does allow ASP.NET applications to have their web.config files changed (like connection string scenario). 

    But MSDeploy may have a bug related to the non default name space.  I wasn't suggesting that you remove the xmlns as a permanent solution, but rather to help identify a bug iis MSDeploy.  If it starts working when the xmlns is removed, that means there is still a product which can be fixed before final release later this summer. 

  • 05-17-2009, 2:21 PM In reply to

    Re: how to update web.config

    SuperTramp, you are right! Thanks for the tip! It does work after I removed the xmlns attribute. I created a new web app using Visual Studio 2008. The xmlns attribute was not there in web.config. Our application is an ASP.NET app created before VS 2008. Most if not all documentation for web.config still has that xmlns attribute. That means a lot of asp.net apps won't work without this change to web.config.

    I am not sure the significance of that xmlns attribute in web.config. What would happen if we remove it. We may just get some warnings from the IDE. Will it cause runtime problems?

    Anyway, it would be nice if MS can patch that up or document that so that other people won't need to spend a couple days like I did trying to figure it out. Without SuperTramp's tip, I would never have made it to work.

Page 1 of 1 (6 items)
Microsoft Communities