[英]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.