WCF Exposing TCP Endpoints - wcf

In terms of running endpoints that use the netTcpBinding, is my best option via IIS / enabling WAS?
Another option would be to host the TCP endpoints within a Windows Service.
Whats the big sell to utilise IIS/WAS for exposing TCP endpoints in WCF?
Cheers for any wisdom.
Andrew

Hosting TCP endpoints in a Windows Service or by using WAS which is part of IIS 7 is an example of managed hosting.
It really depends on whether you need managed hosting or prefer more control and want to "self host" your WCF service in a console app for example.
Here's a decent MSDN doc with some good info about hosting:
http://msdn.microsoft.com/en-us/library/ms730158.aspx

Related

WCF services on IIS with net.tcp port sharing. Is it good solution according to performance issues?

We are planning to develop a big set of WCF-services with net.tcp binding (about 50 services). They will be hosted on IIS.
As I understand, there are two way to realize it:
Create one site on IIS. Services will be deployed as a IIS application. So, all service will use the same port according to net.tcp binding for site (net.tcp port sharing feature).
Create 50 sites on IIS, one site for one service. Every site will have different port in net.tcp binding - so, every service will work by using different ports.
What kind of way is better according to performance issues? I couldn't find any information about performance of solutions with net.tcp port sharing.
NetTcpPortSharing is the WCF TCP port sharing service. It implements a centralized TCP listener so that multiple processes can listen on the same TCP port.
For more information you can refer this link.
http://msdn.microsoft.com/hi-in/magazine/cc163357(en-us).aspx
Port sharing should not only be only one consideration to deploy your service.
You have to design your deployment based on.
Application Pool.
Crash and recovery.
Server Hardware.
Nature of services (heavy data transaction)

Hosting custom WCF in IIS using NLB

We're in the process of trying to layout a new net topography for our system. We currently host our WCF as a windows service which exposes HTTP, HTTPS, NET TCP, and now AJAX Service endpoints...
Does anyone know if it would be possible to move our WCF into IIS while still having those same exposed end points AND take advantage of IIS Clustering and NLB? Can those exposed end points be part of the NLB? Not sure how it works, I've been doing some research but can't find anything that addresses those concerns.
I'm a little new to WCF and IIS and we're currently in the research phase of this project so any opinions or suggestions would be welcomed and greatly appreciated.
You can move your service hosting from Windows services to IIS as long as you have WAS turned which will be required for tcp bound requests.
You will have to reconfigure your services to support load balancing so take a look at the articles below as a helpful starting point about load balancing.
Things to Consider When Implementing a Load Balancer with WCF
Load Balancing with the Basic HTTP Binding
Questions to consider:
Do you use session enabled contract? Does the service behavior use PerSession? Do you have reliable messaging turned on? Session and reliable session are local to a particular server so failover requires a new session be created. The client has to initiate this by creating a new channel (proxy).
Other helpful articles:
Unable to connect to Windows Server 2008 NLB Virtual IP Address from hosts in different subnets when NLB is in Multicast Mode

How to configure your WCF service to work as normal TCP server?

How can I configure my WCF service to work as a normal TCP server? Is it possible to disable all that binding specific stuff so as to keep your service URL like http://example.com:4444/service and be able to work vith pure HTTP/TCP streams?
I need to be able to work with TCP streams in tandem with WCF services... so I have to make TCP server from one of my WCF services or (and I do not know how) make my self-hosted WCF services work in pair with my stand alone TCP server. However, I just can not find how to make them share the same port so as to be able to call http://example.com:4444/WCFservice/ http://example.com:4444/TCPserver/ (And I have to make them share it; taking 2 ports is not an option.)
The easiest way to add TCP endpoint to the service is modify you web.config file with respect of "WCF Service configuration editor". You can find it in the "Tools" menu of Visual Studio of in context menu of web.config (also in VS). You need add new endpoint with netTcpBinding. The address of such new endpoint will be start with "net.tcp://". For more information you can read http://msdn.microsoft.com/en-us/library/cc949080.aspx.
For net.tcp port sharing read http://msdn.microsoft.com/en-us/library/aa395195.aspx or google for: wcf tcp endpoint port sharing.
A good review of new features of WCF 4 you can find in http://msdn.microsoft.com/en-us/library/ee354381.aspx
And take it easy if somebody don't understand advantages of WCF compares with Winsocket programming. 15 year ago I used sockets and find it cool. Then I used RPC, DCOM etc. Now WCF is the best way if you think about authentication of your endpoint. So take some of previous comments easy.
If you want to work with pure TCP streams you'd probably work with sockets directly and not WCF.
Use WCF when you want things auto implemented for you at the transport layer.

Is is possible to 'relay' a WCF service from another server?

I've got a WCF service on a server on one side of a firewall. I need to access the service from many workstations on the other side of the firewall. The network guys insist that all holes through the firewall are one-to-one so at the mo, I'll have to set up every workstation one by one. There could be loads and it'll get tedious and be prone to errors.
Is it possible to set up a WCF server on this side of the firewall that can in some clever way just act as a proxy to the 'real' WCF service on the other side of the firewall? If so, could you point me to some reference material?
There is a new concept of a WCF Relay service being developed for the Windows Azure "cloud" computing space. That would allow you to create your scenario fairly easily - just host some bits of your service out in the cloud.
See these links for more information:
WCF services hosted on Windows Azure
Software in the cloud: the Relay service
.NET ServiceBus: Hands-On with Relays
or search Google for "WCF Relay Service". There are also a number of new bindings specifically for these WCF scenarios.
Hope this helps.
Marc
UPDATE:
WCF v4 - to be released with .NET 4.0 later this year (2009) will include a RoutingService class which can be used in scenarios like this.
See more info about the WCF4 routing service here:
Content based routing in WCF 4
Routing messages in WCF 4.0
A developer's introduction to WCF .NET 4 Beta 1
I have a few suggestions, maybe one would work in your case:
Place the WCF service outside the firewall. If the WCF service needs to talk to the database, open the database port for the IP address of the machine running the WCF service.
Program or use code generation to create a WCF service that is simply a pass through layer
There may be some functionality in your firewall that allows you to publish an end point

How to host WCF services locally instead of http binding..?

How to host WCF services locally instead of http binding.. I mean the services should be hosted within the .NET environment and not by using http or netTCP.. Could you please help me with the configuration for the same?
What are you trying to achieve here that can't be performed by using http or tcp settings for the local machine for both ends of the WCF contract? WCF isn't just between machines, you can also set it to communicate between different processes on the same machine.
I think you are confusing between hosting a WCF service and a WCF binding. A WCF service can be hosted in many different applications such as standalone executables, windows services, a web server such as IIS, ...
Once you've found an appropriate host for the service you have to decide what binding to use. A binding is used to specify the transport, encoding, and protocol details required for clients and services to communicate with each other.
Note that choosing a host could further limit the choice of bindings available. For example if you decide to host your service in IIS you could only use HTTP/S as transport and NetTcp is not available (in IIS7 it is available through WAS).
How to confgiure NetNamedPipeBinding.
How to: Host a WCF Service in a Managed Windows Service.