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.
Related
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
We have a client server application.
My application need to be changed to work via WCF service in order to receive/send data to the database (security demands).
I also need another service which be hosted at the client side and will connect the client to the WCF service on the server side connect with Https.
The WCF service on the server is in PerSession mode.
Most of my work with the server is insert / select queries.
So my design is:
Client ->windows service ->WCF server service(iis7) ->database.
This windows service act as client and as server at the same time.
Act as server: for the Client application.
Act as client for the WCF service which located at the server.
The application needs to support XP and forward operating systems with .net 4.
The windows service will need to connect the WCF service on demand only (when the client application is launched).
I need to decide in which way to implement the client windows service.
I prefer to implement it with WCF hosted service with TCP/IP, but it feels like over kill to do so.
Should I use other IPC implementations? And if so which one?
So, what is the best way to implement this Windows service?
Thanks
I do not fully understand the point why a windows service should be used on the client side in order to communicate with the WCF service. But the question was not about architectural patterns...
So, for inter-process communication I would use NetNamedPipeBinding.
You can find more information on how to decide which binding to use here.
Using a WCF service for inter-process communication does not feel overkill to me at all. Actually WCF services are quite lightweight except the host initialization process, which should not happen frequently in case of a windows service I guess. WCF provides reliability and extensibility in exchange for this tiny inconvenience.
[EDITED]
I just reread you post, and I would like to clarify some details about the hosting. You can host a WCF service in a Windows Service, which is explained here, but not the other way around. Sorry, if I misunderstood your question. And yes, TCP/IP for inter-process communication is definitely an overkill, but NetNamedPipeBinding uses shared memory according to this article, so it should be the fastest way.
I have a wcf .svc service installed on IIS at Windows 2003 server and clients in asp.net apps, installed on different Windows 2003 servers in the same domain. AFAIK only http transport can be used on IIS host.
I need to specify configuration settings, that
maximize performance and
only my clients(located on my domain) should be allowed to use my service.
The service shouldn't be discoverable and shouldn't be usable from unauthorized clients.
UPDATE: I've concidered message certificate encryption to satisfy 2nd requirement, but it is not good from performance point of view.
The service consists of a number operations with strings or List of strings parameters
[OperationContract]
List<string> TranslateList(List<string> textList);
Strings are short and number in the list is usually small as well. Clients are calling the service synchronously and expect to receive response quickly.
Please suggest which configuration settings to use?
Would settings would be changed for other configurations like
configuration B:clients and service are located on the same Windows 2003 server
configuration C:clients and service are located on the same Windows 2008 server( I expect I could use Named Pipe Transport)
configuration D:clients and service are located on the different Windows 2008 servers.(I expect I could use TCP transport)
Performance: You can Compress your request and response. You can achieve this by using gZip.
My Clients Only
Remove mex binding from your web.config and secondly set httpGetEnabled to false. This way no one can create proxy of your service.
You can use Http Headers to check if the request is coming from your client only. Read more about this here.
For choosing the bindings here is a good article
Configuration B: WSHttpBinding
Configuration C: NetNamedPipeBinding
Configuration D: NetTcpBinding
You can also check performance of NetTcpBinding here
Hope this helps you.
I am fairly new to hosting web applications and web services. Though I was successful in hosting a web application, I am running into road block after road block when trying to host a WCF service with net.tcp binding.
My scenario is as follows, I have a hosted web application that needs to communicate with a hosted WCF service with net.tcp binding through IIS 7.5. As stated the web application is hosted fine and I can browse the web site. However, the web application makes services calls to the WCF service and I am getting the 'TCP error code 10061' message which I believe is due to my hosted WCF service not running. I think this is not running because I attempt to 'telnet localhost 808' to see if the WCF service is running and it is not. I've run through numerous online guides and I still have had no luck. I believe I may be doing something fundamentally wrong with me being a noob and all. I am able to host the service through VS2010 and run the web application and it works fine so I believe my bindings are correct. I've also enabled tcp protocols on both websites in IIS Manager.
So I guess my real question is what are the IIS Manager steps needed to host a WCF service with net.tcp binding? It appears to me that it is not possible to host a net.tcp service through IIS Manager by simply creating a website because IIS Manager wants to bind to an http port.
Here are some things to check:
Ensure the Net.Tcp Listener Adapter windows service is running
Ensure netTcp is listed as an enabled protocol for your website (In IIS Manager, go to Advanced settings for your site)
Ensure netTcp is listed as an enabled protocol for application (directory) that is hosting your services (In IIS Manager, go to the directory hosting your services and select Advanced Settings)
Ensure your IIS site has a binding for net.tcp, with the correct port number listed.
EDIT:
See the following MSDN page for enabling/using non-HTTP bindings in .Net 4 + IIS 7/7.5:
Configuring the Windows Process Activation Service for Use with Windows Communication Foundation
And I discovered that for me it didn't work to use localhost... You should use 127.0.0.1 or the name of your computer.
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