WCF TCP Binding setup between IIS and Service - c#

I developed a WCF service, and now reading about the bindings. It s said that TCP binding is the fastest one, which i like to use, but it requires WCF to WCF communication? What s that exactly means?
I have a an application that s on IIS 7, using ASP.NET and a WCF service. they are on different machines. can i use TCP binding?
When i try tcp binding from client (IIS 7) to WCF service, i m getting connection error.
is it possible to connect to WCF service using only tcp binding from another server with IIS 7?
if there is , how to do it? I open the port on firewall etc. oh , wcftestclient works, my app doesnt. :(
again, CLIENT IS ASP.NET PAGE, SERVICE IS WCF, in the SAME NETWORK.

IIS uses http. So if your intent is to communicate from a WCF client to an ASP.NET application you should use the http binding. In IIS7, you have to manually go through a series of steps to enable non-HTTP bindings, but it's possible. This MSDN article show you how you can do this
http://msdn.microsoft.com/en-us/magazine/cc163357.aspx
If your client application is the ASP.NET application then yes, you should be able to use TCP binding between you ASP.NET application (that is acting as a WCF client) and your other application that is NOT an ASP.NET application but a regular application that is a WCF service
What you might want to try is build a console application as your WCF client using TCP binding and then:
Run it from the same box as your service and ensure things are working correctly.
Run it from the IIS box against your WCF service running on the other box and see if it works.
If both these work then it should work from your ASP.NET application as well.

Related

Can WCF service with net.tcp bindings be accessed over internet?

I have developed a simple WCF service (hosted in a Windows Service) quite similar to following msdn article.
http://msdn.microsoft.com/en-us/library/ff647180.aspx#Step1
How should i deploy it so that it can be accessed over internet using tcp?
One thing is that it will use a different port than HTTP (80) and may be blocked by some firewalls (probably most if not all).
TCP binding is used only when the clients are from the same network. If your clients are outside of your network you will have to use HTTP protocol like basicHttpBinding or wsHttpBinding.
In real time application you have multiple service endpoints with different kind of bindings like for backoffice and stand alone application you use netTcpBinding and for internet application you use wsHttpBinding.

C# Calling WCF behind DMZ

I need to call a WCF service that is behind a DMZ:
WEBDMZ .. LANDMZ
------------- ------------
ClientServer => WCF service
As there is a firewall between the two it's not possible for the Client to connect to the WCF service. So I need the WCF service to connect to the client and "listen" to connections or create a tunnel somehow.
I feel it must be a very common problem but I haven't been able to find a proper solution yet. And no it's not possible to open a port. The connection have to be initiated by the WCF.
The client is a server and can easily host any MSMQ or other service.
It seems like this problem can also be referred to as "reverse proxy" or "reverse tunnel".
Solution ideas:
MSMQ hosted by Client (but I'm afraid if it would just simply be polling all the time and creating a network overhead).
A reverse tunnel/proxy?
WCF Duplex?
I'm looking for the simplest solution, preferably in C# and without 3rd party software. Perhaps there is a WCF configuration that allows for reverse calls?
With .Net version 4, you can look at WCF Routing service at here. Or you can build a routing service by yourself following example from Michele Leroux. Here is the link.
EDIT:
You can build a routing service, put it at WEBDMZ server, it will contains list of endpoint wcf service put at DMZ server. At here it will take role as a service server as well as client connect to services at DMZ server. You also can build a discovery service to configure these endpoints automatically.

Two way communication using netTCPBinding

I am new to WCF (Just a day or 2). I am planning to make an application having Client/Server
WCF Service (On Server hosted as windows service):
Will invoke some commands using (Process.Start())
Will send some information from my database
Questions:
What WCF binding should I use? WsDualhttp or netTCP (Please elaborate if you can)
Does WCF works with SqlServer + EF 4.1
Server UI:
This will primarily will be used to
Start ot stop the above service
Change Address (localhost to [My Ip address]) and Port
Show status of service (Running or dead)
Questions:
How can I Change the address and port of my WCF service from this UI (it will be a different project and hence different config file).
Client App:
Used to issue commands to WCF service.
Get to know if the service is running or dead.
Receive status messages for task completion or faults.
Also, can the windows installer be combined to install ServerUI + WCF Service + Windows service?
WCF Service
Here are a couple links on choosing the right binding. Based on the scenario you're describing, I'd go with the netTCP.
C# - WCF - inter-process communication
Choosing the right WCF binding
WCF and SQL Server are independent of each other, so I wouldn't expect any problems using the Windows service to interact with your database.
I'd suggest reading up on how to start a process from a Windows service.
Server UI
I would suggest hosting another WCF service in your Windows service for interacting with your Server UI. You can use the netNamedPipeBinding since this communication channel will always be local, i.e., on the same box. So your Windows service will host two WCF services - one for the external communication with the client and one for the local communication with the configuration UI.
Installer
Yes, the Windows installer can be used, but that might be overkill for what you're describing. Of the Server UI, WCF Service, and Windows service, the only one that absolutely requires installation is the Windows service. The others could theoretically run simply by copying the assemblies to the target system. You might consider having the Windows service install itself via command line. That way you could get away with a self-extracting executable using software like WinZip. This might be less heavyweight than a formal install. If you go this route, have a look at the step-by-step here.
Ha a look at WCF duplex services:
http://msdn.microsoft.com/en-us/library/ms731064.aspx
Why do you want to have a interface to an windows service? And if you have access to IIS7 and WAS, I would recommend to use it instead of self-hosting in windows service.
Here is a good starting point for WCF Configuration Management:
http://msdn.microsoft.com/en-us/library/ff650534.aspx
Yes, you can use windows installer.
Cheers
--Jocke

Starting WCF Client in IIS

It is possible to have WCF Client that connects persistantly using duplex over net.tcp (netTcpBinding) from IIS?
i.e. the normal way would be to host it in a console app or as a windows service, my question is, could one use a shared hosting type of environment to run a WCF Client application.
i.e. the application isn't ever accessible from the outside, the application just connects to another service and consumes a remote WCF service over the internet.
If the ASP.NET app is the client, you could try loading the WCF Client into an Application or Session variable.
I've done something slightly similar with a System Timer and it worked a treat.

IIS Proxy for a Windows Service hosted WCF Service

I have a Windows Service that is exposing a WCF service thru a net.tcp channel.
Now I want this service to be exposed thru IIS, without being hosted in it. By doing that I will be able to maintain the state in the Windows Service, and I will benefit of the underlying IIS authentication and security.
Is it possible to do that just by using some configurations? Maybe a kind of proxy or passthrough?
UPDATE
Why am I doing that? A good question:
Some processes are running at a scheduled interval, asynchronously.
IIS is recycling AppPools and to trigger it, usually a web request should be issued, so that the AppPool is started.
I can't expose directly the service as a Web service in the Windows Service, because IIS is installed and binded to the IP Address that I want to use.
If I want to expose the service for many clients, using their own TLD, I don't want to have the same process running on each website (maybe for exclusive locks, or just for memory/CPU usage)
Perhaps this clarifies a little the need...
No you have to implement whole new layer in IIS. You will expose new WCF service which will call your WCF service hosted in Windows service. Is it really needed? Why don't you host the service in IIS directly or why don't you expose HTTP endpoint on your Windows service? What state do you maintain in Windows service?

Categories

Resources