WCF – My “Duh!” moment of the week

In preparation for my 70-569 exam, I have been following the Learning Plan for WCF found here
The first step was this webcast found here

I attempted to build a Hello-WCF solution based on what as presented in the webcast and I <thought> I ran into Vista problems.  I set my endpoint like this in the Hosting Service:

serviceHost.AddServiceEndpoint(typeof(IPersonFactory), new NetTcpBinding(), "net.tcp://localhost:9000/PersonFactory");

And I set a reference to that endpoint in the client like this:

IPersonFactory proxy = ChannelFactory<IPersonFactory>.CreateChannel(new

      NetTcpBinding(),new

EndpointAddress("net.tcp://localhost:9000/PersonFactory"));

 

Console.WriteLine(proxy.Echo("Hello World"));

 

I got the following message:


No connection could be made because the target machine actively refused it 127.0.0.1:9000

I tried running VS2008 as an administrator but I got the same message.  I then opened the port in Windows Firewall and then disabling the firewall completely.

I then posted to the MSDN forums here

 

Turns out I was barking up the wrong tree.  By using the “Using” statement, I was closing the port before attempting to have the client make the call.  I quess I was too quick to blame Vista…

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 )

Connecting to %s

%d bloggers like this: