NOTE: This is posted in the Web Deploy blog because this new feature in WebMatrix Beta 3 makes great use of new features in Web Deploy v2.
The new Beta 3 release of WebMatrix includes an exciting new feature: Download Published Site. This feature allows you to download files and databases from your live, previously-published site to your computer so that you can, for example, make and test edits on an up-to-date version before publishing them up to the live site.
To use this feature, you simply need to publish a site once to a web hosting provider using the Web Deploy protocol. Then, click “Download Published Site…” on the Publish ribbon dropdown menu.
1. Install an application or make your own from a template
Site from Gallery walkthrough: http://learn.iis.net/page.aspx/878/create-a-website-from-a-gallery-application/
FAQs for specific applications: http://learn.iis.net/page.aspx/873/installing-publishing-apps-with-webmatrix/
2. Choose a hosting provider and get an account
We recommend the hosting providers noted on this site (http://www.asp.net/webmatrix/hosts) because they have installed and configured Web Deploy. You may not be able to use Web Deploy publishing with a hosting provider that is not featured here. You can also get to this page of recommended hosting providers at any time by choosing “Find Web Hosting…” from the Publish ribbon dropdown menu.
3. Publish your site using the Web Deploy protocol
This page has instructions for doing this: http://learn.iis.net/page.aspx/871/publish-your-website/
(note that some of the feature names/placements have changes slightly since this was published, such as “Configure…” now being called “Settings…”).
4. Download your previously-published site
Start by choosing the Download Published Site… option from the Publish drop down
Next you’ll see the preview dialog which will show any files that are different between your local site and the remote site. Note that the database is checked for download by default – you must uncheck it if you don’t want to overwrite your local database. You can choose to exclude downloading specific files (or all files) by un-checking them. Click Continue when you’re ready to start the download.
The notification bar will start with “Download: Starting…” then will scroll through download actions as they occur and switch to “Download: Complete” when the download is finished. You can click on the link in the notification bar or click the “Run” button to browse your now-up-to-date site.
Workaround for Common Issues:
1. Proxy settings error
Download Published Site Failed Bad gateway: Check proxy settings
The remote server returned an error: (502) Bad Gateway.
Workaround: Same as when publishing. Copied from here (http://blogs.iis.net/bilalaslam/archive/2010/07/29/webmatrix-publishing-common-errors-and-workarounds.aspx) for quick reference: “Error: Bad gateway: check proxy settings
Solution: This one is literally what it says – check proxy settings because Web Deploy traffic is being blocked. Try installing your corporation’s required firewall client, and disabling all settings in Internet Explorer > Tools > Options > Connections > LAN settings.”
2. Download fails with a SQL Server administrator error
Details looks like this:
9:14:15 AM: Download Published Site Failed
9:14:15 AM: Download Published Site Failed Download Published Site Failed
9:14:15 AM: Error Detail:
9:14:15 AM: Logged-in user must have SQL Server administrator privileges to download SQL databases
9:14:15 AM: at Microsoft.WebMatrix.Deployment.MsDeployWorker.Execute(Boolean pullback)
Issue: Due to the way database scripting options are applied during a download, it is required that the application either uses database administrator (sysadmin) credentials in the connection string already or that your logged-in user has SQL database administrator (sysadmin login) permission.
Workaround: Give your logged-in user account sysadmin permissions to the SQL database by adding a login for them. There are directions here for adding a login using SQL Server Management Studio (available from WebPI if not already installed): http://msdn.microsoft.com/en-us/library/aa337562.aspx. Make sure when you add the login that you go to the Server Roles page and check the “sysadmin” box.
3. My site isn’t working after download
Issue: All applications are different, and there’s a chance the one you’re using requires a manual edit somewhere to make the application work again.
Workaround: There may be more information on your application on its FAQ page if it requires a specific action from you: http://learn.iis.net/page.aspx/873/installing-publishing-apps-with-webmatrix/
4. My problems don’t look anything like these or the workarounds aren’t working!
Workaround: Please let us know you are having trouble by posting here: http://forums.iis.net/1166.aspx or logging issues here: https://connect.microsoft.com/site1112/Feedback! Posting to the forum with details of the problem is a good way to get help from the feature team or other users, and your feedback helps us make decisions on how to improve WebMatrix.