How to add a custom HTTP header to every WCF call?

后端 未结 13 2315
不知归路
不知归路 2020-11-22 05:33

I have a WCF service that is hosted in a Windows Service. Clients that using this service must pass an identifier every time they\'re calling service methods (because that i

13条回答
  •  长发绾君心
    2020-11-22 06:19

    A bit late to the party but Juval Lowy addresses this exact scenario in his book and the associated ServiceModelEx library.

    Basically he defines ClientBase and ChannelFactory specialisations that allow specifying type-safe header values. I suggesst downloading the source and looking at the HeaderClientBase and HeaderChannelFactory classes.

    John

提交回复
热议问题