none
connection string in web.config change when published RRS feed

  • Question

  • Hi,

     

    I am not sure this is the right forum. I post my question here because I am using linq to connect to the .mdf file and having an issue on the connection string in the web.config file on an asp.net project and try to publish it locally using VS20120 once click publishing. If this is the wrong foruum category, could someone please point me to the right one? When I pubish my projet locally and it changes the connection string in the web.config file as per below. As a result, the locally published webform couldn’t connect to the database. May I know why? How to ensure that the web.config connection string won’t change after I publish the webform? Thank you in advance! J

     

    Prior publishing:

      <connectionStrings>

        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"

          providerName="System.Data.SqlClient" />

        <add name="Webforms_19Aug2011_DataConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Webforms.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

          providerName="System.Data.SqlClient" />

        <add name="WebformsConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Webforms.mdf;Integrated Security=True;User Instance=True"

          providerName="System.Data.SqlClient" />

      </connectionStrings>

     

     

    After publishing:

    <connectionStrings>

        <add name="ApplicationServices" connectionString="$(ReplacableToken_ApplicationServices-Web.config Connection String_0)"

          providerName="System.Data.SqlClient" />

        <add name="Webforms_19Aug2011_DataConnectionString" connectionString="$(ReplacableToken_Webforms_19Aug2011_DataConnectionString-Web.config Connection String_0)"

          providerName="System.Data.SqlClient" />

        <add name="WebformsConnectionString" connectionString="$(ReplacableToken_WebformsConnectionString-Web.config Connection String_0)"

          providerName="System.Data.SqlClient" />

      </connectionStrings>

     

    Monday, January 9, 2012 3:45 AM

Answers