Can we create a new web site using MS WebDeploy

二次信任 提交于 2019-12-12 10:42:47

问题


I've read many posts, documentation pages etc. regarding WebDeploy via VS2012 and via command line.

In all of the deployment scenarios, I noticed that the destination site should already exist on the destination machine (IIS).

Is there an option to create a package that creates the site if it doesn't exist on the destination (hosting) machine?


回答1:


The appHostConfig provider will create a site on the remote server. It comes with a million caveats on setting the remote bindings and physical path, so test it in a local environment first. You'll also need to be admin (obviously).

Since you are using VS2012 to perform your publish (as opposed to msdeploy directly). You should be able to automatically create the website by doing the following:

  • Run Visual Studio 2012 as administrator
  • Ensure that "Use Local IIS Server" is set in project properties
  • Ensure that "Project Url" is correct (and, if a virtual directory, does not end in a /)
  • Declare <IncludeIisSettings>true</IncludeIisSettings> inside a <PropertyGroup> in your publish profile

It should then include appHostConfig in the deployment.

If you want to also create the application pool, you'll need to enable AppPoolExtension in your publish profile:

<PropertyGroup>
    <PublishEnableLinks>AppPoolExtension</PublishEnableLinks>
</PropertyGroup>


来源:https://stackoverflow.com/questions/12725777/can-we-create-a-new-web-site-using-ms-webdeploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!