Microsoft's msdeploy provides the Web. config transform method, which provides the Web. config transformation capability during release to cope with deployment in different modes. When you create an ASP. NET project in vs2010, the debug and release web. config versions are provided by default. For details, refer to msdn.
In other scenarios, you also need to change the Web. config content during deployment, but you need to specify the parameters to be changed through external (such as the installation program. This requires the parameterization of Web. config. This part does not seem to be detailed on msdn (or I did not find it ).
Some related instructions are found here (please bring your own wall flip tool ).
Abstract:
Step 1: Create parameters. xml and set the parameters you want to change during deployment.
I didn't find the corresponding schema, and it was a little troublesome to write it by hand. I didn't need much parameterized content this time. First, give a reference (from the above blog)
Code <? XML version = "1.0" encoding = "UTF-8"?>
<Parameters>
<Parameter name = "log folder location" Description = "Please provide a shared location where the app can write log files to" defaultvalue = "\ logs \ mvcapp \ logs \" tags = "">
<Parameterentry kind = "xmlfile" Scope = "\ WEB. CONFIG $" match = "/configuration/appsettings/Add [@ key = 'logfolder']/@ value"/>
</Parameter>
<Parameter name = "WCF service1 endpoint address" Description = "Please provide the endpoint address for service1 that this MVC app needs to call" defaultvalue = "http: // localhost: 61938/service1.svc "tags =" ">
<Parameterentry kind = "xmlfile" Scope = "\ WEB. CONFIG $" match = "// system. servicemodel/client/Endpoint/@ address"/>
</Parameter>
</Parameters>
Describe the attributes of parameter (from the preceding blog)
Name-must be an attribute and cannot be repeated.
Description-When IIS manager is used for deployment, it will appear in the UI
Defaultvalue-not required
Scope-use a regular expression to indicate the location of the Parameter
Kind-there are many types, but you only need to remember two types
Xmlfile-use XPath to transform web. config or other XML files
Textfile-you can search for and replace non-XML files. For example, you can define @ replacementme @ to replace
Match-depends on kind. If kind = xmlfile, match is defined as an XPath. If it is textfile, match is the phrase you predefine In the transformed file, for example, @ replacementme @@
Step 2: Package
Step 3: Use IIS manager or command line deployment, which is not discussed in this article.
[Update] Here is a more detailed document