WCF Client configuration - base address?

前端 未结 1 1357
清歌不尽
清歌不尽 2020-12-10 18:37

I\'m connecting a WCF client to a group of services all implementing the same contract and all at the same host. I was hoping that there would be a way to combine the endpo

相关标签:
1条回答
  • 2020-12-10 19:34

    There is the concept of a base address in WCF - unfortunately, that only works if you self-host, e.g. host your service in a console app or NT service. However, that only works on the server side - there's nothing similar on the client side. On the client side, you always have to define the complete, full service address your endpoint should connect to.

    If you host in IIS, your service address is determined by the server name, the virtual directory (and possibly subdirectories under that) and the name of the *.svc file used to host the service in IIS. This is a fixed system convention and you cannot influence it, unfortunately (.NET 4 will bring some remedy to that).

    0 讨论(0)
提交回复
热议问题