I'm new here at CodeGuru.com. And I'm starting with a thread about WCF-services.
I have experience with WCF hosted in IIS and self-hosted in a Windows Service.
But I have experienced a new sort of demand which I cannot seem to find any good solution to.
When I host my WCF services in a Win Service app, I have possibility to load external DLLs (assemblies), look for classes which implements an interface or class that I have created, and then load the content as WCF services by using the ServiceHost class.
My host application does therefore not have to have a reference to those DLL-files. So they can be DLLs that I create specifig for customers that has other needs, etc etc. Like "plug-ins".
I now have to host my WCF services in IIS.
This means that all the configuration in the Web.Config file.
I have one WCF service that is always started. This one has config for service, endpoints and behaviors in the web.config file.
If I haven't misunderstood too much, in order to add my services as <service> tags in my web.config file, I have to have reference to the DLL that contains the .SVC-file and other functional code.
I don't wanna have references to the "plug-in" DLLs. Because (as explained) this may be generic DLLs that follow interfaces of base classes that I have created.
My question :
IS it possible to still use the ServiceHost to start more WCF-services, but still use the endpoints and behaviors that I have set up in the web.config file?
I don't know if I have managed to explain my "scenario" completely.
So feel free to ask foro information in order to help me in my quest :-)
Yeah, I also usually host my services in a Windows Service because of the reasons you have :-)
But this is unfortunately a customer related demand, that they want it hosted in IIS.
First of all, that's their environment. And I think they would ilke to create Silverlight-apps to the service some time in the future, and then IIS is less hazzle because of the "cross-domain" xml stuff and such.
And...I also believe they would like an easier port the solutino to some Cloud solution in the future. And that way is easier from IIS than from a self-hosted app (they say).
I couldn't find any good arguments that my usual Windows Service self-hosting would be bullet proof in those two scenarios. So they said that IIS is the way to host.
I'll look more into it.
I hope someone out there may have some suggestions :-)
I tried to create a "WCF Service Application" project. That allowed me to create a WCF application that is hosted in IIS. That is also the project that has the "Web.Config"-file that contains the endpoint, behavior and service configuration of the services I have.
So far, so good. I can create any service I like and add it here.
But this means that all the services that I would like to start must be in my "WCF Server Application" project, or a project that is referenced to. Then I can add services in the web.config file.
But my need is that I would like the "WCF Service Application" to not have references to the services I'd like to start. Because these are customer-specific and plugin-related services that the main project may not know about. I use late binding and "Assembly.Load()" to get classes from these assemblies.
But I guess this is a restriction in IIS.
It works fine when I self-host my services.
Blah...Well... Thanks for any ideas :-) Anything is something!
I appreciate the replies :-)
But my need is that I would like the "WCF Service Application" to not have references to the services I'd like to start. Because these are customer-specific and plugin-related services that the main project may not know about.
You were clear from your first post what you were looking for - unfortunately I don't have the answer.
Perhaps you can convince your client to host with a Windows Service?
Btw, I've written an article series on using WCF to communicate between a Windows Service and a Tray Icon application.
I dynamically load WCF services from a Window Service. You might find my approach interesting (or not <g>).