简体   繁体   中英

Removing ConnectionString when deploying with Visual Studio 2012

I'm working on a project with 2 web applications, one being hosted as long running process (with appfabric), the other is just a normal MVC application. They share same datacontext, thus same connectionString. The appfabric application is deployed as a child application of the main, taking advantage of the web.config inheritance (we don't want connectionstring to be duplicated in web config)

My problem is that with the new Visual Studio 2012 wizard for publishing, the connectionString are automatically added, even when I untick the "Use this connection string at runtime" box.

I also try to use web config transform like this:

  <connectionStrings>
      <add xdt:Transform="RemoveAll" />
  </connectionStrings>

But connection string are still on my web config after publishing.

Any suggestions ? I'm thinking about removing completely the web config for that child application but it's not ideal.

answer can be found here: Web Deploy / Publish is adding a unknown connection string?

Add this project property to the .csproj file by editing the XML:

<Project>
    <PropertyGroup>

         <AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings>

   ...
    </PropertyGroup>
...
</Project>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM