WCF Service custom message inspector

后端 未结 1 613
难免孤独
难免孤独 2020-12-20 08:08

I built a WCF Service that uses custom username and password authentication and I am testing it from the client app with the following code:

using (ServiceRe         


        
相关标签:
1条回答
  • 2020-12-20 08:58

    The options mentioned in the comments above are good for testing. If you want something more robust that you can include in your code, then I think what you want to implement is a WCF Message Inspector.

    More on how to do this on the client:

    You can inspect or modify the incoming or outgoing messages across a WCF client by implementing a System.ServiceModel.Dispatcher.IClientMessageInspector and inserting it into the client runtime.

    https://msdn.microsoft.com/en-us/library/ms733786(v=vs.110).aspx

    And a good example:

    https://weblogs.asp.net/paolopia/writing-a-wcf-message-inspector

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