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

后端 未结 13 2477
不知归路
不知归路 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:30

    If I understand your requirement correctly, the simple answer is: you can't.

    That's because the client of the WCF service may be generated by any third party that uses your service.

    IF you have control of the clients of your service, you can create a base client class that add the desired header and inherit the behavior on the worker classes.

提交回复
热议问题