This tutorial shows you how to run Orchard on your development machine (that doesn't run Windows Server) not with Visual Studio's built-in Cassini webserver, but using a proper IIS webserver. As the database we'll use a standard SQL Server database, that's advised for non-trivial production installations, unlike SQL CE.
Update (25th of June, 2016): Added link to a later blogpost about installing SQL Server 2016 and SQL Server Management Studio 2016.
The video shows everything in detail, but here are the main points you have to follow, together with corresponding links. First we'll install IIS, corresponding tools and set up our Orchard instance as a website in IIS. Then we'll set up a local SQL Server too.
- Install WebMatrix, this will install Web Platform Installer as well. You may ask yourself "Why do I need WebMatrix? I'm not a rookie!" However WebMatrix is still a nice lightweight tool for certain tasks, especially for checking the SQL CE database of your experimental Orchard instances your run locally: WM's SQL browser is much more straightforward to use than SQL Server Management Studio for small datasets (what you'll likely have when you develop something and you want to dig around int the DB) and it supports SQL CE out of the box.
Also, installing WM will install some dependencies that we'll need anyway, like IIS Express.
If you absolutely want to avoid WM you could install Web PI directly, then install the latest IIS Express through Web PI as a minimum.
- Install IIS Manager (IIS Manager for Remote Administration) from Web PI. IIS Manager will enable us to edit the setup of IIS from a graphical interface. Actually as its name tells, you can use IIS Manager not just to manage your local IIS, but also remote servers (if they enable this).
- Install the following extensions through Web API: ASP.NET 4.5 or newer if you have it listed in Web PI (needed for running ASP.NET web apps) and IIS Recommended Configuration, HTTP Errors at least, but you'll likely need URL Rewrite too. If you don't have .NET 4.5 or newer already installed (because you run a system older than Windows 8) then you should install that (also possible through Web PI) first.
- Set up your first Orchard website in IIS by opening IIS Manager and doing the following:
- Add a new web site from under Sites.
- Under Physical Path browse the Orchard.Web folder of the instance you want to run with IIS.
- As the default binding the most simple value you can use is something like mysite.127-0-0-1.org.uk. This address looks like a public one but loops back to localhost. This way you can run your sites with a nice url, without having to set up that it's a localhost one in the hosts file.
- Go to Application Pools in IIS Manager. Make sure the app pool you've created runs on the latest .NET framework.
Also change the app pool's identity (under its Advanced Settings to your account with your user's credentials. This will come handy when setting up the SQL Server connection where we'll not use an SQL database user/pass combo but the connection will have "integrated security" (i.e. will use our user). If you use DB users then you don't need to change the app pool's identity, just remember to include that user/pass in your site's connection string then.
- Don't forget to build your solution latest at this point otherwise you'll see "Parser Error: Could not load type 'Orchard.Web.MvcApplication'." messages.
- At this point you can open up your site and install it with SQL CE just as usual. But we want more! We want full SQL Server!
That's why we download SQL Server Express 2012 Advanced Tools (look for SQLEXPRADV_x64_ENU.exe), or if you're from the future, then the 2140 version of the same tool (I don't think SQL will ever die...). This includes everything we need. Update: here is SQL Server 2014 Express SP 1 (again, download SQLEXPRADV_x64_ENU.exe to get everything).Please visit our later blogpost about installing SQL Server 2016 and SQL Server Management Studio 2016.
- In the setup choose "New SQL Server stand-alone installation" and install SQL Server. You can basically leave everything on the default (you can set up your server as a default or named instance, it doesn't really matter most of the time; if you want to access your SQL server from under "localhost" though, select default).
- Now you can connect to your local SQL Server and explore it through SQL Server Management Studio that was installed through Advanced Tools. You can connect with your server's name (if you've chosen to give the server a name when installing), using just "localhost" or by using your computer's name.
- In Sql Server Configuration Manager make sure to enable TCP/IP connections under "SQL Server Network Configuration" (and as prompted, restart the SQL Server service under "SQL Server Services" in the Config Manager). Otherwise Orchard wouldn't be able to connect to the server.
- Now you can install Orchard backed by a full SQL Server! Orchard will need an existing DB, so create one from SQL Server Management Studio. Then you can use the following connection string at setup: "Data Source=localhost;Initial Catalog=MyDatabase;Integrated Security=True". Notice "Integrated Security": this means the connection won't need a user/pass as it will just use your Windows user's credentials. This is only possible because we've set up the app pool to run as your user in 4/4!
Here we only showed how to run Orchard using IIS, but not how to also make Orchard development. But this part is fairly easy: you can always run your site through IIS by opening its url, without even opening Visual Studio.
If you change something on the code because of Orchard's dynamic compilation feature you don't even have to hit Build (just remember to save project files too: use Ctrl + Shift + S to save all in VS if you've added a new file to your module for example).
Naturally you can also attach the debugger to the IIS process running Orchard, that can be made a matter of a mouse click with the AttachTo extension.