Question

I built a WCF Service in one of my machines of my local network, it has both http and net.tcp (htpp,net.tcp) as enabled protocols in IIS manager.

From another machine a build a client app, and define the endpoints automatically using the Add Service Reference... dialog, I type the service address and when it appears I set the name and click OK. The App.config is updated with two endpoints, one for http (BasicHttpBinding) and the other for net.tcp (NetTcpBinding) as expected.

When running the client app, if I use the BasicHttpBinding:

"using (var proxy = new ProductsServiceClient("BasicHttpBinding_IProductsService"))"

it runs OK, and shows the expected data.

But when I use the NetTcpBinding:

"using (var proxy = new ProductsServiceClient("NetTcpBinding_IProductsService"))"

It throws a SecurityNegotiationException saying that:

"A remote side security requirement was not fulfilled during authentication. Try increasing the ProtectionLevel and/or ImpersonationLevel."

If I do it all in the same machine, I don´t get any exception.

What should I do?

Rafael

Was it helpful?

Solution

By default, the BasicHttpBinding supports no security. So when calling the service from another computer, it will work also. But by default, NetTcpBinding requires a secure channel. And the default security mode is Transport, so when calling the service from another computer, it will throw a security exception.

The most easy way to solve it is to set the security mode to None as following:

<bindings>
    <netTcpBinding>
        <binding name="netTcpBindingConfiguration" >
            <security mode="None" />
    </binding>
</netTcpBinding>

Then we use it in the endpoint

<endpoint address="net.tcp://nelson-laptop:8080/Whatever"
            binding="netTcpBinding"
            bindingConfiguration="netTcpBindingConfiguration"
            contract="ProductsService.IProductsService"
            name="NetTcpBinding_IProductsService" />

OTHER TIPS

In Your question you are using the default net.tcp port 808 but have opened port 80 in the firewall. If it is not a typo in the question it could be why it fails.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top