Using Web Deploy and Visual Studio to Import/Export IIS8 Sites
In this companion post to, “How to Install WebDeploy on Windows Server 2012”, we’ll be giving a walk-through of using Visual Studio 2012 to perform an import, or one-click Publish deployments to your Web Deploy enabled IIS8 sites. We’ll also show you how to export your site from within IIS8 Manager.
Let’s begin with an import, or a one-click Application Deployment from Visual Studio 2012 to our Web Deploy enabled website.
I created a new ASP .NET Web Forms Application in Visual Studio 2012 called Gabe Test Application.
In this project, I am going to just leave the defaults. So that it is just the standard .NET Web Form Application template.
Now we will Publish this application with the one-click using the Web Deploy settings to my test website on the server where we configured Web Deploy.
In Solution Explorer, right-click on your application, and click Publish. This will bring up the Publish Web Wizard:
Now, remember the Publish file we created earlier when setting up the Web Deploy Publish settings on our site? This is the file we can import here into Visual Studio. Copy this file to your desktop or to a shared location and then click Import… and select the file.
You will then be on the Connection section of the wizard. Notice the Publish method: Web Deploy and that the service URL, Site information, and the Username all match. The only thing we need to do is enter the password for local non-admin user.
Once you type in the password, select Validate Connection. You’ll probably get a Certificate Error, this is ok as we have not configured this. If you have configured a Certificate for your site, you can View Detail to ensure everything matches before proceeding then click Next.
On the Settings portion of the Wizard, you have the option to specify different SQL server and connection strings. You can even attach a database.
This is extremely useful when deploying from Staging to Production where these values should be different.
On the Preview page, click Start Preview and here you will see what files will be added to the destination.
Once you click Publish, the Output section of Visual Studio will update you on the progress, notice this build succeeded!
Now on the server, I can confirm that this was successfully pushed:
Now if I wanted to export this site from IIS Manager, I would right-click the site > Deploy > Export Application. This launches the Export Application Wizard. As you can see it will select everything associated with my site.
Need to encrypt your package? Just click Advanced Settings… and set a password:
Click Next, here you can edit the current parameters by selecting the Provider Path or you can Add Parameters if needed (Database strings). These settings look familiar, as just with Visual Studio, you can make changes to these options.
Next specify where to save your application:
When you click Next it will start the Export. When it is completed, take a look at the zip file:
The Content folder will contain your application from the root folder level, and the XML files are used in an Import. You can now Import this site to another IIS server that is configured for Web Deploy by using the Deploy > Import Application function. Then, ensure the zip file is in a location the destination server has access and point the Import Wizard to your zip file.
To recap, WebDeploy can help developers manage and publish their sites/applications. You can:
-Quickly and easily publish your sites via one-click from Visual Studio
-You can export your site and move it to another server with a simple wizard to zip file
For further information on Visual Studio and one-click deployment, check out the MSDN article:
We hope you found the above information to be useful in using Visual Studio 2012 to perform an import, or one-click Publish deployments to your Web Deploy enabled IIS8 sites. To learn more about how we perform these types of solutions for our Dedicated, Cloud and Hybrid Hosting clients, give us a call at 1-855-780-0955, or shoot us an email at Sales@sherweb.com.