Orchard Hungary is an archive

This site is now an archive. We'll keep it so the content is accessible, but we won't update it anymore. However, we frequently publish Orchard-related news on our other site Orchard Dojo, so be sure to check that out instead. And if you're interested in news about our Orchard development company, Lombiq, check out our website.

Visual Studio Web Deploy to IIS

Tags: Orchard, IIS, maintenance, Visual Studio, Web Deploy, brotip

Here is the second episode of the "Orchard vs. IIS" trilogy!
The first episode in a nutshell: creating an Application Pool in IIS Express 7.5, stopping the Default Web Site to make port 80 available, creating a new web site and attaching it to the Orchard.Web folder.
The last episode is available here.

To be able to upload your Orchard installation to a remote server running IIS, you need to follow the same steps as described in the previous part except for one thing: since the Orchard.Web folder doesn't exist on the server, the source of the site should be an empty folder under "C:/inetpub", let's call it "CoconutWeb". So in an instant, we have an Application Pool with a running site that is empty, let's give it some content!

First, open the Visual Studio solution of your Orchard site. In the right-click menu of the Orchard.Web project, choose "Publish...". Create a new publish profile by clicking <New...>, enter a name (eg. "CoconutPublish"), and fill in the form:

  • Publish method: Web Deploy
  • Service url: https://<ip or domain>:<port>/MsDeploy.axd, eg.:
    • https://12.34.56.78:910/MsDeploy.axd
    • https://coconutpie.com:910/MsDeploy.axd
  • Site/application: the name of the site that was created in IIS, in our example "CoconutSite"
  • Leave the following two checkboxes by their default value
  • Allow untrusted certificate: check
  • User name: the name of your user account on the server
  • Password: the password for your user account
  • Save password: check

Don't forget to save your profile!

Before publishing, you should make your site unreachable to prevent user requests from causing an error while uploading (eg. while uploading the database, someone writes to your shoutbox which is stored in the database). A user-friendly way to do this is to use App_Offline; this method is described in one of the previous articles.

Finally, make sure that the "Build configuration" is set to "Release" and hit Publish!

Ad.1.:
The checkbox for "Leave extra files on destination" indicates whether those files that are on the server but aren't among the files to be deployed will be deleted or not. If it's checked, these "extra files" will remain on the server untouched. This includes e.g. files in the Media folder; better check this, unless you are absolutely certain you have an exact copy of the live site locally and all other files (like outdated shape overrides) should be deleted.

Ad.2.:
When publishing, during the compilation the "Deployment Package" is created which is a .zip file with the contents of Orchard.Web folder (compiled; BTW this is compiled in the mode selected in VS, so take care of selecting Release). You may want to deploy your site manually; this is the package you need then. By default, this package is created under Orchard.Web in 3 folders of depth. To relocate the package right-click on the Orchard.Web project, choose Properties and the under the "Package/Publish Web" tab browse a new destination folder for "Location, where package will be created:".

One last thing that is worth mentioning about IIS is the URL Rewrite module for removing ".www" from the beginning of URLs and to transform addresses based on IP to the domain name. URL Rewrite can be installed via Web Platform Installer.
Setting it up is just as easy as the previous tasks: click URL Rewrite in the settings page of your site and add a new rule. Select "Canonical Domain Name" under "SEO", enter the desired domain name (in our example "coconutpie.com") and it's done.

In the next episode: installing and setting up the Windows SMTP Server, configuration of Windows Firewall (safety first) and Orchard.Email.

1 Comment