部署 Web 程序包Deploying Web Packages

作者: Jasonby Jason Lee

下载 PDFDownload PDF

本主题介绍如何使用 Internet Information Services (IIS) Web 部署工具(Web 部署)2.0 将 web 部署包发布到远程服务器。This topic describes how you can publish web deployment packages to a remote server by using the Internet Information Services (IIS) Web Deployment Tool (Web Deploy) 2.0.

可以通过两种主要方式将 web 包部署到远程服务器:There are two main ways in which you can deploy a web package to a remote server:

  • 您可以直接使用 Msdeploy.exe 命令行实用程序。You can use the MSDeploy.exe command-line utility directly.
  • 可以运行生成过程生成的 [项目名称] .deploy .cmd文件。You can run the [project name].deploy.cmd file that the build process generates.

不管使用哪种方法,最终结果都是相同的。The end result is the same regardless of which approach you use. 实质上,所有 .deploy .cmd文件都是运行包含某些预先确定值的 msdeploy.exe,因此,您无需为部署包提供尽可能多的信息。Essentially, all the .deploy.cmd file does is to run MSDeploy.exe with some predetermined values, so that you don't have to provide as much information in order to deploy the package. 这简化了部署过程。This simplifies the deployment process. 另一方面,通过使用 Msdeploy.exe,你可以更加灵活地实现包的部署方式。On the other hand, using MSDeploy.exe directly gives you a lot more flexibility over exactly how your package is deployed.

你使用哪种方法取决于各种因素,包括部署过程所需的控制量,以及你是面向 Web 部署远程代理服务还是 Web 部署处理程序。Which approach you use will depend on a variety of factors, including how much control you require over the deployment process and whether you're targeting the Web Deploy Remote Agent service or the Web Deploy Handler. 本主题说明如何使用每种方法,并识别每种方法的适用时间。This topic explains how to use each approach and identifies when each approach is appropriate.

本主题中的任务和演练假定:The tasks and walkthroughs in this topic assume that:

运行 [项目名称] . .deploy .cmd文件是部署 web 包的最简单方法。Running the [project name].deploy.cmd file is the simplest way to deploy a web package. 特别是,使用 .deploy .cmd文件比直接使用 msdeploy.exe 具有以下优势:In particular, using the .deploy.cmd file offers these advantages over using MSDeploy.exe directly:

  • 您无需指定 web 部署包—的位置。 .deploy .cmd文件已经知道了它所在的位置。You don't need to specify the location of the web deployment package—the .deploy.cmd file already knows where it is.
  • 您无需指定SetParameters文件的位置。—该文件已知道该文件所在的位置。You don't need to specify the location of the SetParameters.xml file—the .deploy.cmd file already knows where it is.
  • 不需要指定源和目标 Msdeploy.exe 提供程序— 。 .deploy .cmd文件已经知道要使用哪些值。You don't need to specify source and destination MSDeploy providers—the .deploy.cmd file already knows which values to use.
  • 不需要指定 Msdeploy.exe 操作设置— 。 .deploy .cmd文件会自动将通常需要的值添加到 msdeploy.exe 命令。You don't need to specify MSDeploy operation settings—the .deploy.cmd file adds the commonly required values to the MSDeploy.exe command automatically.

使用 .deploy .cmd文件部署 web 包之前,应确保:Before you use the .deploy.cmd file to deploy a web package, you should ensure that:

  • .Deploy .cmd文件,[项目名称]。SetParameters文件和 web 包([项目名称]。zip)位于同一个文件夹中。The .deploy.cmd file, the [project name].SetParameters.xml file, and the web package ([project name].zip) are in the same folder.
  • Web 部署(Msdeploy.exe)安装在运行 .deploy文件的计算机上。Web Deploy (MSDeploy.exe) is installed on the computer that runs the .deploy.cmd file.

.Deploy .cmd文件支持各种命令行选项。The .deploy.cmd file supports various command-line options. 当你从命令提示符运行该文件时,这是基本语法:When you run the file from a command prompt, this is the basic syntax:

[project name].deploy.cmd [/T | /Y]
                          [/M:<computer name>]
                          [/A:<Basic | NTLM>]
                          [/U:<user name>]
                          [/P:<password>]
                          [/L]
                          [/G:<true | false>]
                          [Additional MSDeploy.exe flags]

您必须指定 /t标志或 /y标志,以指示您是要分别执行试用版还是实时部署(不要在同一命令中使用这两种标志)。You must specify either a /T flag or a /Y flag, to indicate whether you want to perform a trial run or a live deployment respectively (don't use both flags in the same command). 下表说明了每个标志的用途。This table explains the purpose of each of these flags.

FlagFlag 说明Description
/T/T 使用 – whatif标志调用 msdeploy.exe,这指示试用版。Calls MSDeploy.exe with the –whatif flag, which indicates a trial run. 它不会部署包,而是创建一个报表,其中包含部署包时将发生的情况。Rather than deploying the package, it creates a report of what would happen if you did deploy the package.
/Y/Y 调用不带 – whatif标志的 msdeploy.exe。Calls MSDeploy.exe without the –whatif flag. 这会将包部署到本地计算机或指定的目标服务器。This deploys the package to the local computer or the specified destination server.
一样/M 指定目标服务器名称或服务 URL。Specifies the destination server name or service URL. 有关可在此处提供的值的详细信息,请参阅本主题中的端点注意事项部分。For more information on the values you can provide here, see the Endpoint Considerations section in this topic. 如果省略 /m标志,包将部署到本地计算机。If you omit the /M flag, the package will be deployed to the local computer.
/A/A 指定 Msdeploy.exe 应用于执行部署的身份验证类型。Specifies the authentication type that MSDeploy.exe should use to perform the deployment. 可能的值为NTLMBasicPossible values are NTLM and Basic. 如果省略 /a标志,则身份验证类型默认为NTLM ,以便部署到 Web 部署远程代理服务,并为部署到 Web 部署处理程序的基本身份验证。If you omit the /A flag, the authentication type defaults to NTLM for deployment to the Web Deploy Remote Agent service and to Basic for deployment to the Web Deploy Handler.
/U/U 指定用户名。Specifies the user name. 这仅适用于使用基本身份验证的情况。This applies only if you're using basic authentication.
/P/P 指定密码。Specifies the password. 这仅适用于使用基本身份验证的情况。This applies only if you're using basic authentication.
/L/L 指示应将包部署到本地 IIS Express 实例。Indicates that the package should be deployed to the local IIS Express instance.
/G/G 指定使用tempAgent 提供程序设置部署包。Specifies that the package is deployed using the tempAgent provider setting. 如果省略 /g标志,则该值默认为falseIf you omit the /G flag, the value defaults to false.

Note

每次生成过程创建 web 包时,它还会创建一个名为 [项目名称]. deploy-readme的文件,用于说明这些部署选项。Every time the build process creates a web package, it also creates a file named [project name].deploy-readme.txt that explains these deployment options.

除了这些标志以外,还可以将 Web 部署操作设置指定为其他 .deploy参数。In addition to these flags, you can specify Web Deploy operation settings as additional .deploy.cmd parameters. 你指定的任何其他设置只会传递到基础 Msdeploy.exe 命令。Any additional settings you specify are simply passed through to the underlying MSDeploy.exe command. 有关这些设置的详细信息,请参阅Web 部署操作设置For more information on these settings, see Web Deploy Operation Settings.

假设要通过运行 .deploy .cmd文件将 ContactManager web 应用程序项目部署到测试环境。Suppose you want to deploy the ContactManager.Mvc web application project to a test environment by running the .deploy.cmd file. 你的测试环境配置为使用 Web 部署远程代理服务,如配置用于 Web 部署发布的 Web 服务器(远程代理)中所述。Your test environment is configured to use the Web Deploy Remote Agent service, as described in Configure a Web Server for Web Deploy Publishing (Remote Agent). 若要部署 web 应用程序,需要完成以下步骤。To deploy the web application, you need to complete the next steps.

使用 .deploy .cmd 文件部署 web 应用程序To deploy a web application using the .deploy.cmd file

  1. 生成并打包 web 应用程序项目,如生成和打包 Web 应用程序项目中所述。Build and package the web application project, as described in Building and Packaging Web Application Projects.

  2. 按照为Web 包部署配置参数中所述,修改ContactManager文件以包含测试环境的正确参数值。Modify the ContactManager.Mvc.SetParameters.xml file to contain the correct parameter values for your test environment, as described in Configuring Parameters for Web Package Deployment.

  3. 打开命令提示符窗口并导航到ContactManager文件所在的位置。Open a Command Prompt window and navigate to the location of the ContactManager.Mvc.deploy.cmd file.

  4. 键入以下命令,然后按 Enter:Type this command, and then press Enter:

    ContactManager.Mvc.deploy.cmd /Y /M:TESTWEB1 /A:NTLM
    

在此示例中:In this example:

  • /Y标志指示你要实际部署包,而不是执行试用运行。The /Y flag indicates that you want to actually deploy the package, rather than doing a trial run.
  • /M标志指示你要将包部署到名为 TESTWEB1 的服务器。The /M flag indicates that you want to deploy the package to the server named TESTWEB1. 在此值中,Msdeploy.exe 将尝试将包部署到 http://TESTWEB1/MSDeployAgentServiceWeb 部署远程代理服务。From this value, MSDeploy.exe will attempt to deploy the package to the Web Deploy Remote Agent service at http://TESTWEB1/MSDeployAgentService.
  • /A标志指示你希望使用 NTLM 身份验证。The /A flag indicates that you want to use NTLM authentication. 因此,无需指定用户名和密码。As such, you don't need to specify a user name and password.

若要演示如何使用 .deploy. .deploy文件来简化部署过程,请查看使用上面所示的选项运行ContactManager时生成和执行的 msdeploy.exe 命令。To illustrate how using the .deploy.cmd file simplifies the deployment process, take a look at the MSDeploy.exe command that gets generated and executed when you run ContactManager.Mvc.deploy.cmd using the options shown above.

msdeploy.exe 
-source:package='C:\Users\matt.FABRIKAM\Desktop\ContactManager-03\ContactManager\
 Publish\Out\_PublishedWebsites\ContactManager.Mvc_Package\ContactManager.Mvc.zip' -dest:auto,computerName='TESTWEB1.fabrikam.net', authtype='NTLM',
 includeAcls='False' 
-verb:sync 
-disableLink:AppPoolExtension 
-disableLink:ContentExtension 
-disableLink:CertificateExtension 
-setParamFile:"C:\Users\matt.FABRIKAM\Desktop\ContactManager-03\ContactManager\
 Publish\Out\_PublishedWebsites\ContactManager.Mvc_Package\
 ContactManager.Mvc.SetParameters.xml"

有关使用 .deploy .cmd文件部署 web 包的详细信息,请参阅如何:使用 .Deploy .Cmd 文件安装部署包For more information on using the .deploy.cmd file to deploy a web package, see How to: Install a Deployment Package Using the deploy.cmd File.

使用 Msdeploy.exeUsing MSDeploy.exe

尽管使用 .deploy .cmd文件通常可简化部署过程,但在某些情况下,最好直接使用 msdeploy.exe。Although using the .deploy.cmd file generally simplifies the deployment process, there are some situations when it's preferable to use MSDeploy.exe directly. 例如:For example:

  • 如果要以非管理员用户的身份部署到 Web 部署处理程序,则不能使用 .deploy .cmd文件。If you want to deploy to the Web Deploy Handler as a non-administrator user, you can't use the .deploy.cmd file. 这是因为 Web 部署2.0 中的 bug,如终结点注意事项中所述。This is due to a bug in Web Deploy 2.0, as described under Endpoint Considerations.
  • 如果要在不同位置的不同SetParameters文件之间手动切换,你可能更愿意直接使用 msdeploy.exe。If you want to manually switch between different SetParameters.xml files in different locations, you may prefer to use MSDeploy.exe directly.
  • 如果要重写几个 Msdeploy.exe 命令行参数,则可以直接使用 Msdeploy.exe。If you want to override several MSDeploy.exe command-line arguments, you may prefer to use MSDeploy.exe directly.

使用 Msdeploy.exe 时,需要提供三个关键信息片段:When you use MSDeploy.exe, you need to provide three key pieces of information:

  • 一个 -source参数,用于指示数据的来源。A –source parameter that indicates where your data is coming from.
  • 一个 – dest参数,用于指示数据的目标位置。A –dest parameter that indicates where your data is going to.
  • – Verb参数,用于指示要执行的操作A –verb parameter that indicates the operation you want to perform.

Msdeploy.exe 依赖于Web 部署提供程序来处理源数据和目标数据。MSDeploy.exe relies on Web Deploy providers to process source and destination data. Web 部署包含大量提供程序,这些提供程序可以使用—的应用程序和数据源(例如,存在用于 SQL Server 数据库、IIS web 服务器、证书、全局程序集缓存(GAC)程序集、各种不同配置文件以及许多其他类型的数据)的提供程序。Web Deploy includes a lot of providers that represent the range of applications and data sources it can work with—for example, there are providers for SQL Server databases, IIS web servers, certificates, global assembly cache (GAC) assemblies, various different configuration files, and lots of other types of data. – Source参数和 – dest参数都必须指定提供程序,格式为 – source: [providerName] = [location]。Both the –source parameter and the –dest parameter must specify a provider, in the form –source:[providerName]=[location]. 将 web 包部署到 IIS 网站时,应使用以下值:When you're deploying a web package to an IIS website, you should use these values:

  • –源提供程序始终打包The –source provider is always package. 例如:For example:

    -source:package='[path to web package]'
    
  • – Dest提供程序始终是自动的。例如:The –dest provider is always auto. For example:

    -dest:auto='[server name or service URL]'
    
  • –谓词始终同步The –verb is always sync.

    -verb:sync
    

此外,还需要指定其他特定于提供程序的设置和常规操作设置In addition, you'll need to specify various other provider-specific settings and general operation settings. 例如,假设要将 ContactManager web 应用程序部署到过渡环境。For example, suppose you want to deploy the ContactManager.Mvc web application to a staging environment. 部署将面向 Web 部署处理程序,并且必须使用基本身份验证。The deployment will target the Web Deploy Handler and must use basic authentication. 若要部署 web 应用程序,需要完成以下步骤。To deploy the web application, you need to complete the next steps.

使用 Msdeploy.exe 部署 web 应用程序To deploy a web application using MSDeploy.exe

  1. 生成并打包 web 应用程序项目,如生成和打包 Web 应用程序项目中所述。Build and package the web application project, as described in Building and Packaging Web Application Projects.

  2. 按照为Web 包部署配置参数中所述,修改ContactManager文件以包含过渡环境的正确参数值。Modify the ContactManager.Mvc.SetParameters.xml file to contain the correct parameter values for your staging environment, as described in Configuring Parameters for Web Package Deployment.

  3. 打开命令提示符窗口并浏览到 Msdeploy.exe 的位置。Open a Command Prompt window and browse to the location of MSDeploy.exe. 这通常位于%PROGRAMFILES%\IIS\Microsoft Web 部署 V2\msdeploy.exe。This is typically at %PROGRAMFILES%\IIS\Microsoft Web Deploy V2\msdeploy.exe.

  4. 键入此命令,然后按 Enter (忽略换行符):Type this command, and then press Enter (disregard the line breaks):

    MSDeploy.exe
      -source:package="[path]\ContactManager.Mvc.zip"
      -dest:auto,
            computerName="https://stageweb1:8172/MSDeploy.axd?site=DemoSite",
            username="FABRIKAM\stagingdeployer",
            password="Pa$$w0rd",
            authtype="Basic",
            includeAcls="False"
      -verb:sync
      -disableLink:AppPoolExtension
      -disableLink:ContentExtension
      -disableLink:CertificateExtension
      -setParamFile:"[path]\ContactManager.Mvc.SetParameters.xml"
      -allowUntrusted
    

在此示例中:In this example:

  • – Source参数指定提供程序并指示 web 包的位置。The –source parameter specifies the package provider and indicates the location of the web package.
  • – Dest参数指定自动提供程序。The –dest parameter specifies the auto provider. ComputerName设置在目标服务器上提供 Web 部署处理程序的服务 URL。The computerName setting provides the service URL of the Web Deploy Handler on the destination server. Authtype设置指示你要使用基本身份验证,因此,你需要提供用户名密码The authtype setting indicates that you want to use basic authentication, and as such you need to provide a username and a password. 最后, includeAcls = "False" 设置指示您不希望将源 web 应用程序中的文件的访问控制列表(acl)复制到目标服务器。Finally, the includeAcls="False" setting indicates that you don't want to copy the access control lists (ACLs) of the files in your source web application to the destination server.
  • – Verb: sync参数指示你要复制目标服务器上的源内容。The –verb:sync argument indicates that you want to replicate the source content on the destination server.
  • – DisableLink参数指示不需要在目标服务器上复制应用程序池、虚拟目录配置或安全套接字层(SSL)证书。The –disableLink arguments indicate that you don't want to replicate application pools, virtual directory configuration, or Secure Sockets Layer (SSL) certificates on the destination server. 有关详细信息,请参阅Web 部署链接扩展For more information, see Web Deploy Link Extensions.
  • – SetParamFile参数提供SetParameters文件的位置。The –setParamFile parameter provides the location of the SetParameters.xml file.
  • – AllowUntrusted开关指示 Web 部署应接受受信任的证书颁发机构颁发的 SSL 证书。The –allowUntrusted switch indicates that Web Deploy should accept SSL certificates that were not issued by a trusted certification authority. 如果要部署到 Web 部署处理程序,并且已使用自签名证书来保护服务 URL,则需要包括此开关。If you're deploying to the Web Deploy Handler, and you've used a self-signed certificate to secure the service URL, you need to include this switch.

自动部署 Web 包Automating Web Package Deployment

在许多企业方案中,你需要将 web 包部署为更大的单步或自动部署的一部分。In a lot of enterprise scenarios, you'll want to deploy your web packages as part of a larger single-step or automated deployment. 无论你是选择通过运行 .deploy文件还是直接使用 msdeploy.exe 来部署 web 包,都可以参数化命令,并从 Microsoft 生成引擎(MSBuild)项目文件中的目标调用它们。Regardless of whether you choose to deploy your web packages by running the .deploy.cmd file or by using MSDeploy.exe directly, you can parameterize your commands and call them from a target in a Microsoft Build Engine (MSBuild) project file.

在 "联系人管理器" 示例解决方案中,查看Publish文件中的PublishWebPackages目标。In the Contact Manager sample solution, take a look at the PublishWebPackages target in the Publish.proj file. 对于名为PublishPackages的项列表标识的每个 .deploy .cmd文件,此目标运行一次。This target runs once for each .deploy.cmd file identified by an item list named PublishPackages. 目标使用属性和项元数据为每个 .deploy文件生成一组完整的参数值,然后使用Exec任务来运行命令。The target uses properties and item metadata to build up a full set of argument values for each .deploy.cmd file and then uses the Exec task to run the command.

<Target Name="PublishWebPackages" Outputs="%(PublishPackages.Identity)">
  ...
  <PropertyGroup>
    <_WhatIfSwitch>/Y</_WhatIfSwitch>
    <_WhatIfSwitch Condition=" '$(_WhatIf)'=='true' ">/T</_WhatIfSwitch>
    <_Cmd>
      %(PublishPackages.FullPath) $(_WhatifSwitch) /M:$(MSDeployComputerName) 
      /U:$(MSDeployUsername) /P:$(Password) /A:$(MSDeployAuth) 
      %(PublishPackages.AdditionalMSDeployParameters)
    </_Cmd>
  </PropertyGroup>
  <Exec Command="$(_Cmd)"/>
</Target>

Note

若要更深入地了解示例解决方案中的项目文件模型以及一般的自定义项目文件的简介,请参阅了解项目文件了解生成过程For a broader overview of the project file model in the sample solution, and an introduction to custom project files in general, see Understanding the Project File and Understanding the Build Process.

终结点注意事项Endpoint Considerations

无论你是通过运行 .deploy文件还是直接使用 msdeploy.exe 来部署 web 包,你都需要为你的部署指定计算机名称或服务终结点。Regardless of whether you deploy your web package by running the .deploy.cmd file or by using MSDeploy.exe directly, you need to specify a computer name or a service endpoint for your deployment.

如果使用 Web 部署远程代理服务配置目标 web 服务器以进行部署,请将目标服务 URL 指定为目标。If the destination web server is configured for deployment using the Web Deploy Remote Agent service, you specify the target service URL as your destination.

http://[server name]/MSDeployAgentService

或者,你可以将服务器名称单独指定为目标,Web 部署将推断远程代理服务 URL。Alternatively, you can specify the server name alone as your destination, and Web Deploy will infer the remote agent service URL.

[server name]

如果使用 Web 部署处理程序配置目标 web 服务器以进行部署,则需要将 IIS Web 管理服务(WMSvc)的终结点地址指定为目标。If the destination web server is configured for deployment using the Web Deploy Handler, you need to specify the endpoint address of the IIS Web Management Service (WMSvc) as your destination. 默认情况下,这将采用以下格式:By default, this takes the form:

https://[server name]:8172/MSDeploy.axd

您可以使用 .deploy .cmd文件或 msdeploy.exe 直接作为此类终结点的目标。You can target any of these endpoints using either the .deploy.cmd file or MSDeploy.exe directly. 但是,如果你想要以非管理员用户的身份部署到 Web 部署处理程序,如为Web 部署发布(Web 部署处理程序)配置 Web 服务器中所述,需要将查询字符串添加到服务终结点地址。However, if you want to deploy to the Web Deploy Handler as a non-administrator user, as described in Configure a Web Server for Web Deploy Publishing (Web Deploy Handler), you need to add a query string to the service endpoint address.

https://[server name]:8172/MSDeploy.axd?site=[IIS website name]

这是因为,非管理员用户没有 IIS 的服务器级访问权限;他(她)只能访问特定的 IIS 网站。This is because the non-administrator user doesn't have server-level access to IIS; he or she only has access to a specific IIS website. 撰写本文时,由于 Web 发布管道(WPP)中存在 bug,因此无法使用包含查询字符串的终结点地址运行 .deploy .cmd文件。At the time of writing, due to a bug in the Web Publishing Pipeline (WPP), you can't run the .deploy.cmd file using an endpoint address that includes a query string. 在此方案中,需要直接使用 Msdeploy.exe 来部署 web 包。In this scenario, you need to deploy your web package by using MSDeploy.exe directly.

Note

有关 Web 部署远程代理服务和 Web 部署处理程序的详细信息,请参阅选择 Web 部署的正确方法For more information on the Web Deploy Remote Agent service and the Web Deploy Handler, see Choosing the Right Approach to Web Deployment. 有关如何配置特定于环境的项目文件以部署到这些终结点的指南,请参阅配置目标环境的部署属性For guidance on how to configure your environment-specific project files to deploy to these endpoints, see Configure Deployment Properties for a Target Environment.

身份验证注意事项Authentication Considerations

无论是通过运行 .deploy文件还是直接使用 msdeploy.exe 来部署 web 包,都需要指定身份验证类型。Regardless of whether you deploy your web package by running the .deploy.cmd file or by using MSDeploy.exe directly, you need to specify an authentication type. Web 部署接受两个可能的值: NTLM基本Web Deploy accepts two possible values: NTLM or Basic. 如果指定基本身份验证,还需要提供用户名和密码。If you specify basic authentication, you also need to provide a user name and password. 选择身份验证类型时,需要注意以下几个因素:There are various factors you need to be aware of when you select an authentication type:

  • 如果要部署到 Web 部署远程代理服务,则必须使用 NTLM 身份验证。If you're deploying to the Web Deploy Remote Agent service, you must use NTLM authentication. 远程代理服务不接受基本身份验证凭据。The remote agent service doesn't accept basic authentication credentials.
  • 如果要部署到 Web 部署处理程序,则可以使用 NTLM 或基本身份验证。If you're deploying to the Web Deploy Handler, you can use either NTLM or basic authentication. 默认设置为 "基本身份验证"。The default setting is basic authentication. 尽管基本身份验证依赖于以纯文本格式传输的用户名和密码,但你的凭据受到保护,因为 Web 部署处理程序始终使用 SSL 加密。Although basic authentication relies on user names and passwords being transmitted in plain text, your credentials are protected as the Web Deploy Handler always uses SSL encryption.
  • 如果你的 web 包包含数据库,并且 web 服务器和数据库服务器是单独的计算机,则你将无法使用 NTLM 身份验证部署数据库,因为ntlm "双跃点" 限制If your web package includes a database, and the web server and database server are separate machines, you won't be able to deploy the database using NTLM authentication due to the NTLM "double-hop" limitation. 需要在部署连接字符串中使用 SQL Server 凭据,或提供基本身份验证凭据以 Web 部署。You need to either use SQL Server credentials in your deployment connection string or supply basic authentication credentials to Web Deploy. 成员资格数据库部署到企业环境中更详细地介绍了此问题。This issue is described in more detail in Deploying Membership Databases to Enterprise Environments.

结束语Conclusion

本主题介绍了如何通过运行 .deploy .cmd文件或直接使用 msdeploy.exe 来部署 web 包。This topic described how you can deploy a web package either by running the .deploy.cmd file or by using MSDeploy.exe directly. 本文介绍了每种方法可能适用的情况,并说明了如何在较大的单步或自动生成过程中将部署命令参数化和运行。It explained when each approach might be appropriate, and it described how you can parameterize and run a deployment command as part of a larger single-step or automated build process.

其他阅读材料Further Reading

有关如何创建和参数化 web 部署包的指南,请参阅生成和打包 Web 应用程序项目配置 web 包部署的参数For guidance on how to create and parameterize a web deployment package, see Building and Packaging Web Application Projects and Configuring Parameters for Web Package Deployment. 有关如何从 Team Foundation Server (TFS)实例生成和部署 web 包的指南,请参阅为自动 Web 部署配置 Team Foundation ServerFor guidance on how to build and deploy web packages from a Team Foundation Server (TFS) instance, see Configuring Team Foundation Server for Automated Web Deployment. 有关如何自定义部署过程和排查其问题的信息,请参阅从部署中排除文件和文件夹For information on how to customize and troubleshoot the deployment process, see Excluding Files and Folders from Deployment.