Web部署是否可以创建IIS站点和应用程序池

Web部署是否可以创建IIS站点和应用程序池,iis,msbuild,webdeploy,application-pool,devops,Iis,Msbuild,Webdeploy,Application Pool,Devops,我正在研究部署过程的自动化,我需要找到一种方法来构建和部署asp.net网站 除此之外,我还想为新创建的IIS创建IIS站点和应用程序池(如果还不存在) Web部署是否可能实现这一点(或者是否有更好的方法/工具/方法来实现这些目标?考虑使用Miceosoft.Web.Administration命名空间中的ServerManager类。特别是应用程序池和站点属性。 比如说, ServerManager sm = new ServerManager(); Site site = serverMgr

我正在研究部署过程的自动化,我需要找到一种方法来构建和部署asp.net网站

除此之外,我还想为新创建的IIS创建IIS站点和应用程序池(如果还不存在)


Web部署是否可能实现这一点(或者是否有更好的方法/工具/方法来实现这些目标?

考虑使用Miceosoft.Web.Administration命名空间中的ServerManager类。特别是应用程序池和站点属性。 比如说,

ServerManager sm = new ServerManager();
Site site = serverMgr.Sites.Add(“MySiteName”, “C:\\inetpub\\wwwroot”, 8080);
sm.ApplicationPools.Add(“MyAppPool”);
sm.CommitChanges()
有关更多信息,请参阅


希望这有帮助。

还有MSBuildExtensionPack:

我猜想,上述msbuild操作系列使用Microsoft.Web.Administration命名空间在IIS 7中创建新网站方面发挥了神奇的作用,脚本看起来是这样的(尚未在我自己的服务器上测试):


$(BaseDeploymentName)$(DeploymentNumber)
$(部署编号)
$(网站路径)
/MyApp
$(网站路径)
<Target Name="ProvisionIIS7WebSite" DependsOnTargets="CreateDeploymentNumber">
  <PropertyGroup>
    <WebSiteName>$(BaseDeploymentName)$(DeploymentNumber)</WebSiteName>
    <PortNumber>$(DeploymentNumber)</PortNumber>
  </PropertyGroup>

  <ItemGroup>
    <WebApplication Include="/MyApp">
      <PhysicalPath>$(WebSitePath)</PhysicalPath>
    </WebApplication>
    <VirtualDirectory Include="/MyVdir">
      <ApplicationPath>/MyApp</ApplicationPath>
      <PhysicalPath>$(WebSitePath)</PhysicalPath>
    </VirtualDirectory>
  </ItemGroup>

  <!-- Create new site -->
  <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Create"
    Name="$(WebSiteName)"
    Port="$(PortNumber)"
    Path="$(WebSitePath)"
    AppPool="$(WebSiteAppPool)"
    Applications="@(WebApplication)"
    VirtualDirectories="@(VirtualDirectory)">
    <Output TaskParameter="SiteID" PropertyName="WebSiteID" />
  </MSBuild.ExtensionPack.Web.Iis7Website>
  <Message Text="Created website with ID $(WebSiteID)" />
</Target>