简体   繁体   English

Web Deploy可以创建IIS站点和应用程序池吗

[英]Can Web Deploy create IIS Site and Application Pool

I am working on automation of deployment process and I need to find a way to build and deploy an asp.net web site. 我正在致力于部署过程的自动化,我需要找到一种构建和部署asp.net网站的方法。

On top of this I would also like to create IIS Site and Application Pool for newly created IIS if one doesn't already exist. 在此之上,我还想为新创建的IIS创建IIS站点和应用程序池(如果尚不存在)。

Is this possible with Web Deploy (or is there an even better way/tool/approach to achieve these goals?) Web Deploy是否有可能(或者是否有更好的方法/工具/方法来实现这些目标?)

Consider using ServerManager class from Miceosoft.Web.Administration namespace. 考虑使用Miceosoft.Web.Administration命名空间中的ServerManager类。 Specifically, ApplicationPools and Sites properties. 具体来说,是ApplicationPools和Sites属性。 For example, 例如,

ServerManager sm = new ServerManager();
Site site = serverMgr.Sites.Add(“MySiteName”, “C:\\inetpub\\wwwroot”, 8080);
sm.ApplicationPools.Add(“MyAppPool”);
sm.CommitChanges()

For more information see https://msdn.microsoft.com/en-us/library/microsoft.web.administration.servermanager(v=vs.90).aspx 有关更多信息,请参见https://msdn.microsoft.com/zh-cn/library/microsoft.web.administration.servermanager(v=vs.90).aspx

Hope this helps. 希望这可以帮助。

There's also MSBuildExtensionPack: 还有MSBuildExtensionPack:

https://github.com/mikefourie/MSBuildExtensionPack https://github.com/mikefourie/MSBuildExtensionPack

I imagine that said msbuild-family-of-actions employs the Microsoft.Web.Administration namespace to work its magic in terms of creating a new website in IIS 7 and the scripting looks something like this (haven't tested this on my own server yet ): 我想象说,msbuild-family-of-actions使用Microsoft.Web.Administration命名空间来发挥其神奇作用,从而在IIS 7中创建新网站,并且脚本看起来像这样(没有在我自己的服务器上测试过) 尚未 ):

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Web 部署错误到 IIS - 应用程序池 managedRuntimeVersion - Web deploy error to IIS - application pool managedRuntimeVersion 通过tfs将Web部署到IIS到站点应用程序 - Web deploy to IIS to a site application from tfs 以编程方式创建新的IIS网站时,如何将其添加到现有的应用程序池中? - When programmatically creating a new IIS web site, how can I add it to an existing application pool? 如何将新的Web应用程序部署到IIS站点的子目录中,而不必单击“转换为应用程序”? - How can I deploy a new web application to a subdirectory of an IIS site and not have to click “Convert To Application”? 在默认web站点IIS下创建应用程序 - Create an application under default web site IIS 在IIS 7上部署Web应用程序 - Deploy a Web Application on IIS 7 Angular2 WebPack部署到IIS中默认网站下的应用程序 - Angular2 WebPack Deploy to Application under Default Web Site in IIS VS2012 Web Deploy Package创建应用程序池 - VS2012 Web Deploy Package to create application pool 使用网站(Microsoft版本)时在IIS上创建Web应用程序? - Create a web application on IIS when using a Web Site (the microsoft version)? 如何将ASP.NET Core目标net452项目部署为IIS中的Web站点的IIS应用程序 - How to deploy an ASP.NET Core targetting net452 project as an IIS application of a Web Site in IIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM