Custom ServiceHost in wcf configuration file?
-
19-08-2019 - |
Question
i wonder if there is a way to specifiy a custom ServiceHost (i.e. a ServiceHost derived class) in configuration? thanks
Solution
I don't think you need to specify anything in a config file in order to use a custom ServiceHost. I haven't tried to do that before, but I see nothing in the config file that would specify information about the ServiceHost.
Here's a web page on MSDN titled "Custom Service Host."
Hopefully some of that helps!
OTHER TIPS
Yes we have just come across this pain too, we wanted to have different endpoints on the ServiceHost, which on the client side is dead simply you just pass in the Endpoint you want when creating the ChannelFactory, however on the server side this is not so simple.
I agree the above you need to create a Custom Service Host and override the ApplyConfiguration() method.
There is an excellent example of doing this here : http://social.msdn.microsoft.com/forums/en-US/wcf/thread/3af366c1-3b11-42e6-85a4-ea63cd48be18/
Hope it helps