If you are running locally and do not have a domain to map, you can edit yourWindowsSystem32driversetchosts
file to create a sample host.
If you are running locally and do not have a domain to map, you can edit yourWindowsSystem32driversetchosts
file to create a sample host.
The following advice is for Windows 7 or Windows Vista and was taken from Orchard Issue Tracker on CodePlex). These instructions assume that you're using WebMatrix and IIS Express to work with Orchard.
-
Open the
WindowsSystem32driversetc
folder. -
Right-click the hosts file and give yourself modify permissions to that file.
-
Open the hosts file in a text editor.
-
Add the following line, replacing
mydemo
with the domain name you want to use:127.0.0.1 mydemo
-
Open the
Users\[YourUserName]DocumentsIISExpressconfig
folder. -
Open the
Applicationhost.config
file in a text editor. -
Locate the section for your existing Orchard site, such as the following:
<site name="mydemo" id="nnnnnnnnn"/>
-
Under the
<bindings>
section, leave the default localhost binding, but copy it onto the next line and edit it to read:<binding protocol="http" bindingInformation="*:28923:mydemo" />
-
Substitute the port number above for the one you copied from the default localhost binding.
If you do not want to run WebMatrix with admin privileges (which is not a good practice for security reasons), you need to follow the steps outlined in the article Handling URL Binding Failures in IIS Express as follows:
-
Open a command window that has administrative privileges. (In All Programs > Accessories >Command Prompt, right-click the program shortcut and then click Run as administrator.)
-
Run the following command:
> netsh http add urlacl url=http://mydemo:28923/ user=everyone
This can later be removed with the following command:> netsh http delete urlacl url=http://mydemo:28923/
Alternatively, you could run WebMatrix using admin privileges as follows:
- Open WebMatrix with admin privileges. (Right-click the shortcut in Windows, then click Run as administrator.)
Finally:
-
Open your site and attempt to start it.
-
Locate the IIS Express icon in the taskbar and right-click it. You see your site name, where you can select to open it via its additional URL.
Remember to remove the item from the hosts file or comment out the line using the #
character if you want to view the live site from the same domain name after you've deployed it to an ISP. You need to be very careful that you are looking at the remote site rather than the local one. Consider adding something to one or other of the themes to make the difference immediately apparent.
Note: Alternatively, instead of editing the hosts file, you can use the URL *.127-0-0-1.org.uk, where * is the name of your tenant or another name of your choosing. This will loop back to localhost and is sufficient for testing multi-tenancy locally.