Sharing port 80 for NetTcpBinding and BasicHttpBinding in IIS 8 hosted WCF service possible? - wcf

I have created a .NET 4.0 WCF service to transfer large files from and to clients. Several sources in the web suggest that streaming via netTcpBinding performs significantly better than streaming via basicHttpBinding (streaming, mtom enabled).
On the other hand, establishing a connection to the server via net.tcp is reported to be prone to fail, in most cases due to firewalls, proxies or other company networking restrictions, while establishing a http connection on port 80 can be taken for granted.
What I'd like to do is to provide the streaming service with both http and net.tcp endpoints on the server side. The client tries to connect to the net.tcp endpoint, and in case of a connection error, connect to the http endpoint.
Is there a way to share port 80 between my http and net.tcp endpoints? I'm using IIS 8 as service host, the clients are tied to .NET 4.0, denying the use of .NET 4.5's newly introduced NetHttpBinding.

You can share ports between multiple basicHttp bindings, or between multiple netTcp bindings, but unfortunately you can't mix and have both netTcp and basicHttp share a port. WCF will give you an AddressAlreadyInUseException for that.

Related

Calling a net.tcp wcf service from Silverlight - in an external facing web site?

I have an external (public) website developed in Silverlight. The Silverlight app currently calls http based wcf services hosted in IIS.
I am now having to call a wcf service with net.tcp binding hosted in a different app server. I have the net.tcp wcf service hosted in a windows service on port range 4502-4530 and with an interface to expose clientaccesspolicy.xml file as part of the service. I am able to invoke this service from my Silverlight app in the web server. I want the SL app to make direct call to net.tcp, rather than routing the call to it from another http based service.
Question is will this work without any issues when exposed over internet.
Client browser --> IIS webserver with Silverlight website --> App Server with wcf service on net.tcp.
I am assuming in this case, from XAP SL would try to make direct call to the app server service using net.tcp ?
The communication between the web server and app server could be opened up for ports 4502-4535. But I am wondering what about the client. Does this setup require the ports to be available even in the clients machine (with browser)?
Any insight is much helpful.
Thanks.
Take a look at http://support.microsoft.com/kb/2425652; there is sample code included as well! If you setup clientaccesspolicy.xml correctly; it should work as long as clients can access your TCP server.
If your clients are behind some firewall which is blocking your server's ports; they may face connectivity issues!

Does IIS work with http-only WCF services?

I'm not a WCF expert, so please don't laugh at me.
I need to write a WCF service that receives data through TCP endpoint, not HTTP. Can I still deploy it to IIS or Azure and take advantage of all cool stuff that's baked in (load distribution, etc.)?
Depends on the version of IIS.
IIS v6 supports HTTP only
with IIS v7, you also get WAS (Windows Process Activation Services) which then also supports TCP and other protocol when hosted in IIS
See:
How to: Host a WCF Services in IIS
Setting up a netTcpBinding enabled service in IIS 7

Silverlight, WCF service relay and security

I have a silverlight 4 application which needs to consumes some services hosted on a Java (I think CXF) Web Service.
For some reasons, I can't access directly the service so I have to go through a relay service.
I created a WCF relay service.
The service uses SOAP 1.2 and WS addressing 1.0
What I ask is.. what level of security can I reach?
The ideal situation is to use a mutual authentication of the server (CXF) and my client.
If Silverlight does not support this, the second possibility is to have a "simple" https connection between my silverlight client and my relay server, but then, is it possible to "add" a mutual authentication between the relay and CXF? Or the only possible solution is to have a simple SSL connection with only the server authentication?

Host WCF in IIS 7 using net.tcp binding

I am hosting a WCF service in IIS 7 through net.tcp binding. I have two questions about IIS configuration.
Can I only configure net.tcp protocol in the the web site containing my service code? All the samples I found so far always append the net.tcp protocol after http protocol.
There are two features we can turn on: Windows Communication Foundation Http Activation and Windows Communication Foundation Non-Http Activation. Some sample state that we need to turn on Non-Http activation and others state that both are required to turn on. My test shows that both are required. However, I do not understand the difference between the two. If only net.tcp protocol is used by my service and client, why should Http Activation be required?
Even if your service is net.tcp the meta data exchange that is used when you add a service reference may be http.
Which tests did you do? If you need more help post your config file.

Is it possible to host a TCP endpoint in an IIS6 hosted service?

I created a wcf service based on ServiceHostFactory, and i'm hosting it in IIS6.
If i use a HTTP endpoint everything works just fine, but when i try to switch to TCP it goes bad.
Is it even possible to do this in II6?
I have a more specific question posted here, that asks for a solution, but i would be happy with (for starters if not) with just an answer (and perhaps an example) to this - less specific question.
Why can't I connect to a WCF service with net.tcp but i can with http?
IIS 5.1 and IIS 6 can only host HTTP bindings. IIS7 has WAS (Windows Activation Service) which allows hosting of endpoints bound to any transport protocol... so it would be capable of TCP.
If you must host with IIS 6, then you're stuck with the HTTP bindings. If not, consider self-hosting in a Windows Service.