Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we create a new web site using MS WebDeploy

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?

like image 377
Ron Klein Avatar asked Oct 04 '12 10:10

Ron Klein


1 Answers

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>
like image 96
Richard Szalay Avatar answered Sep 22 '22 23:09

Richard Szalay