Configuring Multliple Sites On IIS 7

If you're playing along at home since my my last post you should now have the latest and greatest version of ColdFusion installed successfully on IIS.

So now what? Well now we take advantage of the fact that we can create multiple sites under one root. As a refresher here is the example I mentioned in the last post:

  • wwwroot
    • site1
      • components
        • myComponent.cfc
    • site2
      • components
        • myComponent.cfc

In the example above I might have the following code under site1:

<cfset obj = createObject("component", "site1.components.myComponent")>

Which gives us a major headache when we move site1 to production and it's now lying in the root. What would really be cool is if we could have both site1 and site2 set up as seperate sites on the server so that we could call:

<cfset obj = createObject("component","components.myComponent")>

from either site1 or site2 and have both work as expected.

That's where IIS comes in. As previously mentioned I like GUIs. The GUI management console for IIS7 is pretty slick looking. Here's a screenshot of the main console:

So let's add a new site (pay no attention to test1 and test2 in that screenshot above). To add a new site right click on 'Web Sites' and select 'Add New Site'. Wow...that was tough.

This presents us with a simple dialog box of properties for our new site.

This configuration gives us a very nice and easy to use http://test1 URL on our local machine. Now that we've got a site built we can code to our hearts content assuming a simple and easy transition to our production environment.

Oh - almost forgot. You'll also need to modify your hosts file to get your system to recognize the host header you specified in IIS. Here's what it should look like when you're done (assuming you followed my example above and created test1 and test2).

And that is all. As I said in my last post I am under the impression that there is no limitation to the amount of sites you can run on IIS7. This is a nice change from the previous limitations of only being able to run a single site at a time.

Related Blog Entries

Comments
Cool!

Can you also do this (adding multiple sites) for IIS 5.1 on Win XP Pro?
# Posted By William from Lagos | 5/14/07 10:50 AM
I don't think so. See comments in my last post (http://cfsilence.com/blog/client/index.cfm/2007/5/...)
# Posted By todd sharp | 5/14/07 7:02 PM
Cool, great to see ColdFusion developers taking advantage of IIS7! Great post!
# Posted By Bill Staples | 5/19/07 2:45 PM
I use Vista Business with IIS7. In my system the field you show as "Host Header" appears as "Hostname".

I set it to "mysitetest" and also added the entry for mysitetest aliased to the localhost IP (127.0.0.1) and flushed the dns (ipconfig /flushdns) but when I try http://mysitetest/ on the browser rather than getting my site I get the IIS7 splash screen instead.

If I remove the "hostname" (host header in your figure) and leave it blank then I can access my site using the IP address (http://192.168.0.65/).
# Posted By Emilio | 6/30/08 9:15 AM

Calendar

Sun Mon Tue Wed Thu Fri Sat
  12345
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31   

Subscribe

Enter your email address to subscribe to this blog.

Tags

actionscript ajax blogging cfsnippets coldfusion flash forms flex misc model-glue off topic personal project learn slidesix sql

Recent Comments

More CF+Java: Compiling Classes And Persisting Objects
Getburl said: I have been attempting to get Db4o working in my CF application and I have not succeeded. I would lo... [More]

Thoughts On Ajax Frameworks And ColdFusion/Adobe
Erast said: http://fanniecollins.10gb... emo http://gracetrevino.phree...... [More]

Extending Ext With Ext Extensions
Erast said: http://fanniecollins.10gb... emo http://gracetrevino.phree...... [More]

CF Needs An Open Source Contact List Importer
Kay Smoljak said: Heh, the fact that sites DO it doesn't mean they SHOULD. To us it's ok, but to a non-tech-savvy user... [More]

A Few Project Updates
Helena said: Now punctually what is the situation ? [More]

RSS


coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com