问题
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.
回答1:
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>
来源:https://stackoverflow.com/questions/14865379/removing-connectionstring-when-deploying-with-visual-studio-2012