Knowing which PORT is using by which APPLICATION

April 20, 2009 01:49 by admin

Recently for a client need to install our SilverLight application on his laptop for demo over GotoMeeting. The laptop is having Vista 64 bit Windows OS. After installing IIS 7 on it, the webserver's Default Website was not starting. So checked everything - Services, Installed Apps in Programs & Features etc, to see whether Apache or Tomcat or any other webserver is running and blocking 80 port. But couldn't see any of those applications.

Then started hunting to know who is blocking 80 port on that machine. Did little googling and found following 2 commands to know which app is listening to the 80 port.

Through these commands you can know easily which application is listening to a particular port. As well you can see all ports that are exposed and applications that are using them. This is a 2 step process. First we will see ,what are the ports that are listening by different Process Ids. Next using that PID we will get the Application name.

To know the listening ports on your machine type the following command in CMD prompt

netstat -ano | find /i "listening"

Fist column will show you the protocol TCP or UDP, next IP & PORT numbers of Source, next IP & PORT numbers of Destination machine, next State (that we needed to filter the list), and finally the Process Id (PID).

From the last column we will take the Process Id and find the Application of it.

So for that lets Google and download a small application named PUList. The Windows 2000 Resource Kit Tool needs you to go through Genuine OS check, and then you can download the PULIST.EXE. After downloading & installing PUList, navigate to the installed directory in CMD prompt. Run the following command in there,

pulist |find /I "6372"

or just

pulist 

will list all the processes that are running.

Finally we found that Skype is using the port 80. So after exiting it the IIS Default website started working. 


Knowing which PORT is using by which APPLICATION

April 20, 2009 01:49 by admin

Recently for a client need to install our SilverLight application on his laptop for demo over GotoMeeting. The laptop is having Vista 64 bit Windows OS. After installing IIS 7 on it, the webserver's Default Website was not starting. So checked everything - Services, Installed Apps in Programs & Features etc, to see whether Apache or Tomcat or any other webserver is running and blocking 80 port. But couldn't see any of those applications.

Then started hunting to know who is blocking 80 port on that machine. Did little googling and found following 2 commands to know which app is listening to the 80 port.

Through these commands you can know easily which application is listening to a particular port. As well you can see all ports that are exposed and applications that are using them. This is a 2 step process. First we will see ,what are the ports that are listening by different Process Ids. Next using that PID we will get the Application name.

To know the listening ports on your machine type the following command in CMD prompt

netstat -ano | find /i "listening"

Fist column will show you the protocol TCP or UDP, next IP & PORT numbers of Source, next IP & PORT numbers of Destination machine, next State (that we needed to filter the list), and finally the Process Id (PID).

From the last column we will take the Process Id and find the Application of it.

So for that lets Google and download a small application named PUList. The Windows 2000 Resource Kit Tool needs you to go through Genuine OS check, and then you can download the PULIST.EXE. After downloading & installing PUList, navigate to the installed directory in CMD prompt. Run the following command in there,

pulist |find /I "6372"

or just

pulist 

will list all the processes that are running.

Finally we found that Skype is using the port 80. So after exiting it the IIS Default website started working. 


Apache Windows .htaccess - Password Protect Parent and Allow Sub Directory

August 6, 2008 02:10 by admin

To protect a directory in Apache web server, you need to create two files “.htaccess” and “.htpasswd”. “.htaccess” has to be placed under your designated directory. Once you place “.htaccess” under a directory, all its sub directories will inherit its parent properties. Each folder can have its own “.htaccess” file, if it needs to override or extend its parents’ properties.

“.htpasswd” is for storing Usernames and Passwords. It can be placed in the each directory or at a common place to maintain all logins at one place.

In “.htaccess” file you have to specify the path to “.htpasswd”. To protect a web folder the contents in “.htaccess” will be

AuthUserFile C:\wamp\passwords\.htpasswd
AuthName "This is Hasten secret area"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>

kick it on DotNetKicks.com  

To create “.htpasswd” file with Usernames and Passwords in it, you can find a utility “htpasswd.exe” under “<Apache’s installation directory>/bin” or you can create them online using Dave Child’s page.

In command prompt navigate to the above directory and type below command
htpasswd .htpasswd a-user-name

It creates “.htpasswd” file under “<Apache’s installation directory>/bin” itself. Repeat the same command to add more usernames. Cut the file from there and paste it under desired place as mentioned in the “.htaccess” – “AuthUserFile”.

If you create with Dave Child’s page, paste the text in notepad and save file as “.htpasswd” in desired directory as mentioned in the “.htaccess” – “AuthUserFile”.

Up to now we have seen password protecting a parent folder. Now by placing the following “.htaccess” file in sub folder will make it unprotected. The contents in “.htaccess” will be

Allow from all
Satisfy Any

That’s it! It’s simple!

Are you facing any problem, let’s do discuss here, post your comment.
Let me know your feedback.


Apache Windows .htaccess - Password Protect Parent and Allow Sub Directory

August 6, 2008 02:10 by admin

To protect a directory in Apache web server, you need to create two files “.htaccess” and “.htpasswd”. “.htaccess” has to be placed under your designated directory. Once you place “.htaccess” under a directory, all its sub directories will inherit its parent properties. Each folder can have its own “.htaccess” file, if it needs to override or extend its parents’ properties.

“.htpasswd” is for storing Usernames and Passwords. It can be placed in the each directory or at a common place to maintain all logins at one place.

In “.htaccess” file you have to specify the path to “.htpasswd”. To protect a web folder the contents in “.htaccess” will be

AuthUserFile C:\wamp\passwords\.htpasswd
AuthName "This is Hasten secret area"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>

kick it on DotNetKicks.com  

To create “.htpasswd” file with Usernames and Passwords in it, you can find a utility “htpasswd.exe” under “<Apache’s installation directory>/bin” or you can create them online using Dave Child’s page.

In command prompt navigate to the above directory and type below command
htpasswd .htpasswd a-user-name

It creates “.htpasswd” file under “<Apache’s installation directory>/bin” itself. Repeat the same command to add more usernames. Cut the file from there and paste it under desired place as mentioned in the “.htaccess” – “AuthUserFile”.

If you create with Dave Child’s page, paste the text in notepad and save file as “.htpasswd” in desired directory as mentioned in the “.htaccess” – “AuthUserFile”.

Up to now we have seen password protecting a parent folder. Now by placing the following “.htaccess” file in sub folder will make it unprotected. The contents in “.htaccess” will be

Allow from all
Satisfy Any

That’s it! It’s simple!

Are you facing any problem, let’s do discuss here, post your comment.
Let me know your feedback.


Configuring Apache and IIS Web Servers on Single Machine for 80 Port

July 23, 2008 12:10 by Admin

Before on Windows 2003 server, this same configuration has been done successfully. Now on Windows 2008 Web edition tried today it worked too.

First need to download the Support Tools from Microsoft site. Of course it is Windows Server 2003 Service Pack 1 32-bit Support Tools, but we need “httpcfg” command mainly to do this exercise.

kick it on DotNetKicks.com

In order to configure IIS7 and Apache on same machine for port 80, need 2 or more IP addresses configured to your machines’ network card. So that we can use one for Apache and the other to IIS.

In windows 2008 to add more IP is to LAN card, open Control Panel → Network and Sharing Center → Manage network connections

On your ‘Local Area Connection’ right click and open properties. Double click on IP V4 option to open it properties. From ‘Advance’ dialog you can add more IPs to the machine.

To run the support tools commands, better to be in safer side, open the command prompt with administrator privileges.

Change your path to the support tools installed directory, normally

C:\Program Files\Support Tools>

Next execute these commands one after the other to set the IP

httpcfg set iplisten -i xxx.xxx.xxx.xxx

to confirm

httpcfg query iplisten

this will list the IPs that are binded to IIS.

then stop all HTTP services and restart

net stop http /y net start w3svc

This will stop

Windows Remote Management (WS-Management)
World Wide Web Publishing Service
Print Spooler
IIS Admin Service

But it may start only ‘World Wide Web Publishing Service’, so restart your machine once the above setup is done, that will start other dependent services.

In some cases, like DotNetPanel control panel it looks for local loop back URL 127.0.0.1. So need to add the same and restart the HTTP service again.

httpcfg set iplisten -i 127.0.0.1

In Apache’s httpd.conf you can make it listen to 80 port and add IP to your web site

<VirtualHost XXX.XXX.XXX.XXX:80>
    DocumentRoot C:/my.website.path/
    ServerName example.com
    ServerAlias *.example.com
</VirtualHost>

If you have any queries and like to discuss please post your comments below.