开发者

Can I modify Endpoint after it is added to the servicehost?

I am trying to figure out how to get an handle on the endpoints of the service host and modify their identity. I have endpoints defined in the config file but want to modify the endpoints programmatically depending on the environment (ex:QA, UAT, Prod)

Service is hosted on IIS6 and I am using a servicehostfactory to provide my extended servicehost class to IIS.

I am using opening event to get an handl开发者_开发知识库e on the endpoints that are already defined from the config file but can't figure out how to modify their identity. Is that even possible? Are endpoints are immutable after they are created?

If I can't modify the endpoints then is the "Opening" event of the servicehost is the correct event to add a service endpoint?


ServiceHosts are not immutable until they are Opened. You can modify the description of an endpoint after calling AddServiceEndpoint.

When you say Opening event, do you mean you've subclassed ServiceHost and are overriding OnOpening? If so, that's a fine place to add endpoints.

Alternatively, if you're using your own ServiceHostFactory, you can just add your endpoint(s) after calling base.CreateServiceHost.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜