Monday, February 16, 2009

Installing and Running IIS and Apache Server Together on Windows Vista or Windows XP or Windows Server 2003

[Edit] Added new posts: Run IIS behind Apache. and adding more than one IP address to your computer
I run Vista and I have been using Apache for last one month. I wanted to run Python on Apache using FastCGI module mod_fastcgi but a compiled Windows version of this module was not available from FastCGI web site. So, I decided to use IIS7’s built-in FastCGI support.
If you want to run both IIS7 and Apache web server together, than here’s the information you need, just the solution for you. By default IIS7 would listen to all IP addresses your machine is assigned and it means that you can install IIS on your system but you can not run IIS web sites until you turn off Apache HTTP server. In a situation like this IIS will throw this error when trying to start a website.

Cannot Start Web Site
---------------------------
There was an error while performing this operation.
Details:
The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
---------------------------
OK
The solution is to bind a specific and separate IP addresses to IIS and to Apache. There are mainly three steps involved in this.

First and foremost, make sure that you have two IP addresses assigned to your PC

First make sure you have more than one IP address assigned to your system by the cable modem you are using. In some cases you might be using a network router instead of cable modem. Whatever the case may be, you will definitely need a minimum of two IP addresses.
Update: If you can't get two IP addresses for your PC, you can use different port numbers for Apache and IIS.
Open a command prompt and type ipconfig and hit enter. Your system must show at least two IP addresses assigned to it. If you don’t have two IP addresses, get another IP address assigned to you. (Update: you may use two different port numbers)

Second, configure Apache to listen to a specific IP address

Open httpd.conf file from Apache/conf directory and edit the line with ServerName key. This is my new httpd.conf file:
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
# Old value: ServerName 127.0.0.1:80
#

ServerName 192.168.1.177:80
Now, restart your Apache web server.

Finally, configure IIS to bind it to another IP address

IIS binding on Vista requires you to update IIS settings and you will need to use command line tool called netsh. Open a command prompt and type netsh.
netsh is only available on Windows Vista or Windows Server 2008 or later and you will need to start command line with elevated settings. Replace my IP address with your system’s IP address. Repeat “add iplisten ###.###.###.###” for all the IP address bind to IIS.
C:\Windows\system32>netsh
netsh>http
netsh http>add iplisten 192.168.1.164
IP address successfully added
netsh http>show iplisten
IP addresses present in the IP listen list:
192.168.1.164
To make IIS listen to a specific port use the syntax: add iplisten 0.0.0.0:XXX. Replace XXXX with the port number, for example, 8080.

For Other versions of Windows, binding an IP address to IIS:

If you are using other versions of Windows, you will need HttpCfg.exe utility. It is available by default on Windows Server 2003 but if you're using Windows XP you can install HttpCfg.exe as part of the Windows XP Service Pack 2 Support tools. Then open a command prompt and type the following, replacing xxx.xxx.xxx.xxx with the IP address you'd like to bind to IIS:
C:\Windows\system32>httpcfg set iplisten -i xxx.xxx.xxx.xxx
I hope this will help some of you with this specific requirement. To make IIS listen to specific port in Windows XP use the syntax: httpcfg set iplisten -i 0.0.0.0:XXXX - where XXXX is the port number.

Monday, February 2, 2009

Improve performance by placing Application.cfc or Application.cfm, or ColdFusion might locate and execute a file above web root directory

A close look at the following screen clipping will show you exactly why it is important to place an Application.cfc or an Application.cfm file under your web root. If your web root or the requested page’s directory does not have an Application.cfc or Application.cfm file then ColdFusion would search up the directory tree to locate either of the files until it reaches root directory (C:\ and in my case D:\). This is NOT a bug.
clip_image001
Error Occurred While Processing Request
http://localhost/
Screen clipping taken: 2/2/2009, 2:06 PM

Solution to 500 Internal Server Error issue with ColdFusion, IIS7 and Vista 64bit edition

I faced issue with web connector when I recently installed ColdFusion 8 Developer 32bit on my Vista 64bit box.

Issue: The web server configuration fails and ColdFusion pages won't run on IIS or Apache on Vista.

clip_image002

Index of / – Even after installing CF, index.cfm was not processed.
http://localhost/
Screen clipping taken: 2/2/2009, 3:19 AM

Symptoms: You might get an error that pkgmgr process could not be detected. Additionally during installation you will see an error saying web connector failed and you need to manually configure the web connector with your web server, either Apache or IIS. It might also ask you to set your firewall to unblock a port number - 51020, 51011, or 51800.

Simple Solution:

Note: You don’t have to go through all this if, surprise, you had installed 64bit of ColdFusion on your 64bit OS. Therefore, I'd recommend that you use 64bit version of ColdFusion when you are running 64bit version of Vista OS or Linux or Mac OS X.

If you are running ISS 7 and Vista you are getting 500 Internal Server error and then you should update to CF 8.0.1.

In addition to this, 64bit Vista users must enable 32-bit applications under .Net application settings in IIS7 Manager.

Plus, adjust your firewall software to unblock 51020 and 51800 ports.

Finally, run the Web Server Configuration Tool (wsconfig.exe). This exe comes with ColdFusion installation and in Windows a shortcut is available under Start Menu. Use this tool to set up your web server and select the check box that says 'configure web server for ColdFusion 8 applications'.

Technorati Tags: ,,,

☛ Quick Links

♥ Recommended For You