Host WCF in IIS 7 using net.tcp binding - wcf

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.

Related

What is the purpose of the WCF Activation feature?

I create a WCF service in Visual Studio 2013 and publish it to IIS. I can the add a service reference in another project and consume methods on the service. When I go to the IIS Server Manager I see WCF Activation and its two sub-items (HTTP Activation and Non-HTTP Activation) unchecked.
What are these features and how does my WCF site work without them enabled? I've looked around the web quite a bit and haven't found any definitive answers. Thanks.
Before IIS 7.0 you could only host HTTP services on IIS. If you wanted to use non-HTTP protocols (e.g. net.tcp) you had to self-host. Microsoft introduced the Windows Process Activation Service (WAS) to allow common hosting within IIS regardless of the communications protocol being used.
In practical terms, one of the neat features of this is that you can host your net.tcp WCF services on IIS and they will be dynamically activated once traffic starts arriving. Previously you had to have your service running (console app, Windows Service or whatever) before messages began arriving.
Further details can be found in this MSDN article.
If you are just running WCF services using the HTTP protocol and have those services hosted in a IIS web site, the default configuration will just work.

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

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.

Silverlight 4, WCF with net.tcp endpoint, proxy not requesting clientaccesspolicy.xml

I've been trying to have my Silverlight application work with a WCF net.tcp binding the whole day and couldn't make it, even though it seems to me I've done everything right, including after some googling...
I had a WCF service with a basicHttpBinding endpoint which worked perfectly, and as my WCF service and my Silverlight application are on the same network, told myself "why not trying something else than HTTP ?"
So I began googling to see what had to be done, and here's the list of what I did :
Server
Checked that Net.Tcp Listener Adapter service was running
IIS
Enabled net.tcp binding on my website, with binding information set to "4502:*"
Added net.tcp protocol to the Application that hosts my WCF service
Added a policy in the clientaccesspolicy.xml file to allow socket connection on ports 4502-4536
WCF Service
Added a net.tcp binding with Security set to None
Added an endpoint with this binding for my service, keeping the regular HTTP one
After doing all this, I can use my WCF service with WcfTestClient, it sees the two endpoints (HTPP and net.tcp), and both of them work like a charm.
In my Silverlight application, I can update my service reference (which I added with the HTTP address of my service, not the TCP one), and it also sees the two endpoints because it added the TCP endpoint in the ServiceReferences.ClientConfig. As I saw when googling, netTcpBinding is not supported in Silverlight, thus it describes the binding as a custom binding with a and a element.
I saw on the different tutorials I followed that, as for the HTTP binding, Silverlight asks for a socket policy file to check if the client has access to the WCF service. In SL4 Beta, this file was requested by TCP on port 943. As of SL4 RC and RTM, it's requested by HTTP on port 80, as it is for the HTTP bindings.
The thing is, when I launch my application with the proxy set to use the net.tcp binding, I checked with Fiddler, the clientaccesspolicy.xml is NOT requested at any time, and I get the classic error when the socket policy file is not present : TCP error code 10013: An attempt was made to access a socket in a way forbidden by its access permissions.
After googling, I found out that SL looks for this file with the IP address of the server, not its name, but trying http://IP_OF_MY_SERVER/clientaccesspolicy.xml in a browser on my client machine serves the file as expected...
So I'm a bit lost here, I would really like to have it working to see something else than HTTP with WCF...
Someone has any bit of a clue to guess what happens ???
As the service works as expected with WcfTestCLient with the net.tcp binding, I'm guessing this has something to do specifically with SL...
Thanks for reading :-)

Silverlight4 net.tcp binding

Hi
I have a SL4 application which uses a WCF service using net.tcp binding. If i remove http from the protocols of the service in IIS (Advanced settings ) and keep only net.tcp , the service fails with an error saying that the service could not be activated.
Does http need to be added to the proptocols of the service in IIS for the net.tcp to work?
i cannot enable http on IIS for the service protocols.
are there any workarounds
thanks
Ben
Which version of IIS are you using? Net.TCP will fail if you are not using IIS7 or when a butterfly flaps its wings in Tokyo.
Have you seen this blog post?
http://www.silverlightshow.net/items/WCF-NET.TCP-Protocol-in-Silverlight-4.aspx
issue resolved. was something very small that i had overlooked.
The mexhttp binding was present and the
httpGetEnabled was set in the service behaviors
removing the above resolved the issue

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.