When setting up a WCF client and server, how synchronized does the config files must be?

前端 未结 2 715
情深已故
情深已故 2021-02-13 12:09

Most of the WCF examples out there show you how to configure WCF client and server. Now, what happens if you differ the configuration slightly between them? I mean, who has the

2条回答
  •  清酒与你
    2021-02-13 12:31

    If a given timeout is about the same thing in the end, on the client and the server, and the two values don't match, the shorter timeout "wins" - no matter whether it's defined on the server or the client.

    Most other things like addresses, bindings etc. must match - otherwise, no communication will be possible...

    The benefit of the server setup is that you can define multiple endpoints for a single service, with different options and bindings - and the client can then "pick and choose" which endpoint to connect to.

    But once one service endpoint has been chosen for your connection, the settings like bindings, protocols, security, reliability and so forth must match exactly.

    Also: the default config that the Visual Studio Add Service Reference or the svcutil.exe command line tools generate are both catastrophically bad - they contain way too many settings that all reflect the default values, which make it really hard to know what's really needed and what is not.

    In that respect, I'd recommend watching the DotNet Rocks TV Show #122: Miguel Castro on Extreme WCF in which Miguel nicely shows just how easy it really is to create those configs manually, and then you completely understand what the heck you're doing! Highly recommended!

提交回复
热议问题