Search code examples
wpfwcfwcf-hosting

WCF Self hosting


I created a WCF service and hosted that with in a Windows service it is called self hosting. It is clear to me but my question is.

If we are using self hosting in console application/WPF application then do we need to provide WCF code to each installation instance of application. Or will the WCF service be located centrally?


Solution

  • It is absolutely up to you - only application author can make this decision. If you are creating some kind of client/server application then in most cases you will need to install your client (WPF) application separately from your server (Console + WCF) part.

    There are cases, though, when requirements tell you to install them together - again, only you know.

    But there is another aspect - hosting WCF service in console host might not be good idea for production code. How are you going to run it? If it is each time when user logins, then what's the purpose of such a service - you can as well keep same code inside WPF application.

    If it has to be Windows service, then console app will work, but again you need to think carefully what is the usage scenarios of your product - does it require central server or not.