Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one web service (asmx) in separate project that is hosted on windows server having other web applications running on it. How can I restrict web service to be accessed by single IP address? I want that my web service must be accessed by one IP configured by me. If requests comes from any other IP, it must not reach to my web service and discarded by windows firewall itself. I know that this is something to do with windows firewall.

I did it for SQL Server previously, but I don't know how to configure single web service project to do so.

share|improve this question
up vote 0 down vote accepted

Unless your web service is running in a separate IIS instance on a different port than the rest of your sites, there's no way to do what you're asking with the firewall. The firewall can only block things by port, not URL.

So you have two choices.

  1. Move the web service to its own IIS instance running on a non-standard port (81, 8080, etc). Then add your firewall rule that restricts incoming traffic to that port for your designated IP address.

  2. Add code to your web service so that it is actually responsible for rejecting requests that come in from invalid IP addresses. It should be easy enough to do with the session/request objects you have access to.

share|improve this answer
Thank you. I will first go with the first option and then second. I will let you know the outcome. – Suresh Agrawal Mar 12 '11 at 19:05
Do you mean that I have to run it on separate IIS application pool? Can you please tell me how to move web service project to separate IIS instance on a non-standard prot and configure firewall rule. I can't find any option for this. – Suresh Agrawal Mar 14 '11 at 16:55
I am able to change the port binding for whole website. How can I change it for one virtual application? – Suresh Agrawal Mar 14 '11 at 17:27
From the IIS Manager in the Sites section, Add New Site. – Ryan Bolger Mar 14 '11 at 19:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.