Wednesday, June 17, 2009

Running IIS and SQL server in same machine with diferent IP and Same Port

Introduction
In this artical I will explain how to configure IIS and SQL server 2005 in same maching diferent IP and same port.

IIS web site need to start on 
IP : 192.168.10.105  Port : 6666

SQL server need to start on
IP : 192.168.10.28 Port : 6666


Configuring Net work Connection
First we need to assign 2 ip addresses to the NIC. Go to Network connections TCP/IP properties and configure as follows.









Configuring IIS

Go to Web site properties from IIS manager and change settings as follows.




















Then use HttpCfg.exe to configure IIS lisning IPs. In windows 2003 this tool can be found SUPPORT\ folder on installation CD. for more informantion click here

type floowing commands in command prompt. By default httpcfg.exe winn install on "c:\program files\Support tools\"

By default iis will listen for all ips configured to machine. using following command will delete entry for all ip listening. 

httpcfg delete iplisten -i 0.0.0.0

Then add the IP we need to listen using following command

httpcfg set iplisten -i 192.168.10.105

then restart the IIS / Web site from IIS manager.

you can user netstat (netstat -an -p tcp) command to see how the ports are listening.


Configuring SQL Server 2005

Go to Sql Server Configuration Manager. and select correct Sql server instance and double click on TCP/IP appear in right pan.









Then change the settins as follows.












After changes are done re start SQL server.

Again you can user netstat (netstat -an -p tcp) command to see how the ports are listening.

netstat will display as follows.




No comments: