Forcing WcfSvcHost.exe to use my custom service host

爷,独闯天下 提交于 2019-12-05 13:47:46

I was trying exactly the same thing for exactly the same purpose (;-)

I thought I found a solution by not using physical .svc files anymore (which contain the custom host factory when hosting in IIS), but moving this info to the .config file instead:

<serviceHostingEnvironment aspNetCompatibilityEnabled="false">
  <serviceActivations>
    <add relativeAddress="~/Services/NaisTime/NaisTimeService.svc" service="Nais.Time.Services.NaisTime.NaisTimeService"
      factory="Nais.Time.Services.NaisServiceHost.NaisServiceHostFactory, Nais.Time.Services" />
    <add relativeAddress="~/Services/Northwind/NorthwindService.svc" service="Nais.Time.Services.Northwind.NorthwindService"
      factory="Nais.Time.Services.NaisServiceHost.NaisServiceHostFactory, Nais.Time.Services" />
  </serviceActivations>
</serviceHostingEnvironment>

It works for IIS, but putting the same entries in the app.config file of my Service Library project does not make SvcWcfHost use this.

I guess I am not getting my relativeAddress right.

Anybody any experience with this?

kr, Michel Liesmons.

I don't think you can do that - you'll need to host in IIS or create your own, customized service host.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!