1

We are deploying an ASP.Net application to IIS via MSDeploy API. We only want to update existing websites. In our ...pubxml we have defined following:

<ItemGroup>
  <MSDeployParameterValue Include="$(DeployParameterPrefix)ConnectionstringA-Web.config Connection String">
    <UpdateDestWebConfig>False</UpdateDestWebConfig>
  </MSDeployParameterValue>
  <MSDeployParameterValue Include="$(DeployParameterPrefix)ConnectionstringB-Web.config Connection String">
    <UpdateDestWebConfig>False</UpdateDestWebConfig>
  </MSDeployParameterValue>
</ItemGroup>

By default, the setParameters.xml created on publish, looks like this:

    <setParameter name="ConnectionstringA-Web.config Connection String" value="metadata=res://*/itrDTO.csdl|res://*/itrDTO.ssdl|res://*/itrDTO.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=devServer;initial catalog=devDB;User Id=devUser;Password=devPW;MultipleActiveResultSets=True;App=EntityFramework&quot;" />
    <setParameter name="ConnectionstringB-Web.config Connection String" value="data source=devServer;initial catalog=devDB;integrated security=True" />

I also tried to create a "Projectname.wpp.targets" with this configuration inside my project:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings>
  </PropertyGroup>
</Project>

The result is that the connectionstrings are not created inside setparameters.xml.

However, all combinations of configurations here are changing the connectionstrings inside the web.config on the destinationserver. This happens if we import the package by the IIS-ManagementUI AND when we deploy the package by MSDeploy API.

All examples I've found for the "parameterization" - topic are for the IIS-Management process. As I understand parameterization, this is only usefull for manually installing updates, so that the admin has a UI to configure stuff. But we have no UI when we update the systems of our customers.

Update: When I Publish with Visual Studio, here is the funny result: enter image description here I think this means "Hey WebDeploy, keep your hands off the connection strings!"

When I preview the changes, this is the result: enter image description here

1 Answer 1

2

Parameterization is useful both through the IIS install UI and via the commandline. We use WebDeploy/Parameterization for the deployment of all our 40+ applications.

I just ran a test with a new blank ASP.NET application and found that by default the ConnectionString is parameterized but after setting the AutoParameterizationWebConfigConnectionStrings MSBUILD property to false it did not parameterize the ConnectionString. The parameter entry was removed from both the parameters.xml and SetParameters files.

I suggest you clear out your target website folder and republish with this property set.

Also double check that you don't have config transforms or something else that might be changing the config.

Sign up to request clarification or add additional context in comments.

7 Comments

I have deleted the website-folder on IIS and redeployed the Website. When I Update the website, my connectionstrings are changed back to the values of my project - web.config. My setParameters.xml and parameters.xml have no entries for connectionstrings. Where are config.transforms located? The files web.debug.config and web.release.config are still on default.
Config transforms are the web.[env].config files.
yep, they're empty or contain the default data
I've tried this with a blank ASP.Net application, too, but I get the same results. When I open the web.config nested deep inside the publish-package, I can see my Development-Connectionstrings there. Is that good?
WebDeploy creates a local copy of the application in a zipped package then during the deployment it is copying from the zipped package to the target web server. If your goal is to not change the config on the destination you need to parameterize or transform your config to match the target.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.