Home > Uncategorized > Can’t connect to my service, Firewall or not firewall issue ???

Can’t connect to my service, Firewall or not firewall issue ???

Since few month now I am facing to an interresting issue based on WCF service connection.
Actually problem occurs when your WCF service is :

  • Hosted under IIS as WAS
  • Windows Firewal activated
  • Corresponding TCP port open
  • WCF using callback interface

In other words, the same service accessible with the same manner is working and accessible really fine when hosted elsewhere than IIS (console application for instance).

After many testing that I runs, I came from the conclusion that as long as my service is hosted under IIS and it is using callback interface then connection fails.

You can find more details from this issue under the WCF forum where I was posting it at :
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/67065408-694e-4669-a27d-54000e52edbc/

In order to help you understand what I mean I manage to build a small demo application that you can download below.
The demo work as follow :

There is a small test client application which connect to the same service hosted in a console application and IIS.
To configure the service to run under IIS:

  1. extract files inside the file : NotificationServer IIS Service.zip
  2. Create an application from IIS and point it to the extracted folder
  3. Open port TCP 2000 ( use in my test)
  4. Test that you can access the service by opening Internet explorer and type in http://localhost/notificationserver/notifyservice.svc
  5. If the service is accessible you will get the welcome page

Just run the full solution project and you will noticed that when clicking on button to access the service hosted in console it will work and from IIS is will generate an exception

IMPORTANT : All test is run locally on same machine

You can download the test solution and service from here :

Thanks for those who could help be solved that issue before I get no more hairs.

Advertisements
Categories: Uncategorized
  1. dario.sgorbini@live.it
    February 11, 2010 at 3:09 pm

    Hi, I’ve a much simpler example but I can’t connect anyway.
    I’ve got BasicHttpBinding and base address http://localhost:80/

    I stopped IIS who’s listening on port 80 and the Host opens normally.

    when I go in explorer and try to connect to http://localhost:80/ nothing happens…that is I don’t receive errors, I just wait for something to happen.

    if I try to Host the same service with IIS and its .svc file all goes the right way.

    Have you got any idea?

    this is the code:

    static void Main(string[] args) {

    // We did not separate contract from implementation.
    // Therefor service and contract are the same in this example.
    Type serviceType = typeof(HelloService);
    ServiceHost host = new ServiceHost(serviceType, new Uri[] { new Uri(“http://localhost:80/”) } );

    // Add behavior for our MEX endpoint
    ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
    behavior.HttpGetEnabled = true;
    host.Description.Behaviors.Add(behavior);

    // Create basicHttpBinding endpoint at http://localhost:8080/HelloService/
    host.AddServiceEndpoint(serviceType, new BasicHttpBinding(), “HelloService”);

    // Add MEX endpoint at http://localhost:8080/MEX/
    host.AddServiceEndpoint(typeof(IMetadataExchange), new BasicHttpBinding(), “MEX”);
    host.Open();
    Console.WriteLine(“Service is ready, press any key to terminate.”);
    Console.ReadKey();
    host.Close();

    • scalderara
      February 11, 2010 at 8:30 pm

      When you host WCF service under IIS and try to access it with port 80 thought HTTP it will fail as IIS is reserving its port for him.
      You need to change your http port to be different that 80.
      Try to change it and test again..
      let me know if it helps
      serge

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: