Hosting WCF service in LAN
I have got WCF service allowing sending messages between several users in LAN -开发者_JAVA技巧 sth like chat. How should I host it? Any recommandations? This service just should be enabled all the time I think about Console Application but I'm not sure if it's the best solution.
There are a lot of good options. As Alexander said - IIS is one. But it depends on what you want to do with it.
Is there some kind of Server-App you start and interact with then just host the service in there.
But for me the best option is usually to host it inside a simple Windows-Service. For this I write all that is needed in a seperate assembly and use a console-app during my testing and finally just plug the components inside a simple windows-serivce project and install/run it on some server. No need to have IIS running this way.
Here you can see how the windows-service is done: How to: Host a WCF Service in a Managed Windows Service
If it needs to be up all the time, and works in a LAN environment, I would recommend:
- a Windows Service that runs on some machine
- using the
netTcpBinding
to get the best speed possible
There's really no need to put this into IIS - a Windows Service which runs around the clock works like a charm!
See MSDN How-To: Host a WCF Service in a Managed application for more detailed advice
If it is WCF service, you should host it as WCF service, namely as IIS application.
Here is good screencast of that:
http://www.youtube.com/watch?v=mX8quq7MoeI
For intranet scenarios the hosting reccomne recommendation is to use the following decision flowchart, according to Juval Lowy:
Also for regarding the decision to use a windows service or a console application: using a windows service as a host is preferable whenere that is posible.
The hosting options are also described in MSDN, and there's a table with advantages and dissadvantage3s of each hosting option, which can help you decide.
精彩评论