tags:

views:

30

answers:

1

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...

+2  A: 

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?

Ladislav Mrnka
I can't expose the Web service directly because the IP address/port combination is used by IIS. Also, there is some tasks that should run at a specific time of the day, and IIS could be recycled at this time or could not be up (because the AppPool is triggered by a web request).
Curchy
And do you use the IIS on that server? The easiest way is to free the port on IIS (turn off the site blocking the port) and use it in Windows Service. But if you use IIS for other applications it will not be possible. Also consider using another port for your HTTP communication going from Windows service. Otherwise you will have to do what I suggested in my answer.
Ladislav Mrnka
Yes, IIS is used, and the firewall is blocking other ports... If there is no better solution, I will just create a one-to-one layer, as you said.
Curchy
If the Windows Service is on the same server as IIS consider using NetNamedPipeBinding for communication between them. It can be used only for communication on the same machine and it has better performance than Net.Tcp.
Ladislav Mrnka
Ok, thank you for the hint!
Curchy