Buda Gavril
Buda Gavril

Reputation: 21657

WCF: issue with tcp binding in IISExpress

I have a wcf project and I'm creating a client to test it. For some reasons, on my local machine I can run the service only within IIS Express from visual studio. After I start the project, I'm trying to connect to the service from a client, but I'm getting an error:

You have tried to create a channel to a service that does not support .Net Framing. It is possible that you are encountering an HTTP endpoint.

I've read this and this but they're discussing about IIS and not IIS Express.

Here is my code from the client:

NetTcpBinding binding = new NetTcpBinding();
EndpointAddress address = new EndpointAddress("net.tcp://localhost:64255/MyService.svc");
ChannelFactory<IMyInterface> channelFactory = new ChannelFactory<IMyInterface>(binding, address);

channelFactory.Open();
IMyInterface _clientProxy = channelFactory.CreateChannel();
((IClientChannel)_clientProxy).Open();

And when I'm calling the method Open, I'm getting the error above...

Please note that the service accepts only net.tcp protocol.

What do I need to change to call this service hosted in IIS Express from my client?

Edit: when I'm running the project from visual Studio, in the browser I'm seeing the url: http://localhost:64255/MyService.svc

Upvotes: 1

Views: 689

Answers (1)

Buda Gavril
Buda Gavril

Reputation: 21657

Long story short: IIS Express does not support non-HTTP protocols such as net.tcp. IIS Express only supports HTTP and HTTPS as its protocol

Upvotes: 2

Related Questions