From StackOverflow
Http://stackoverflow.com/questions/4879310/when-setting-up-a-wcf-client-and-server-how-synchronized-does-the-config-files
The recent configuration of WCF services has always been a question that we have always configured the WCF server to be consistent with the client side, but what if we do not configure the same? Find the following answers in StackOverflow. In fact, this does not say that there must be work, such as the client's sendtimeout corresponding to the service side of the ReceiveTimeout, and some configuration on the client side is useless. This has to be carefully pondered. I rub ...
In order to address your request in your last comment to my previous answer, I tried to come up with my approach to how I Would create (and modify) Server-and client-side config ' s for any given service. This was based on both theory I read (books, blogs), things I ' ve learned in Juval Lowy ' s WCF Master Class
, and quite a bit of practica L experience with several large service implementation projects-this is ' t available in one single place, on the Web or In a book ... so here it goes:
I would start basically from scratch. Think about your service first:
- What address does your service live at?
- What binding (s) does you want to support?
Simplest Scenario:single service, single endpoint, BasicHttpBinding, all defaults
Service Config:
<system.serviceModel> <services> <service Name= "Yournamespace.yourserviceclass" > span class= "tag" ><endpoint name= " Default " address=" http://YourServer/ Somevirtualdirectory/yourservice.svc " binding= "BasicHttpBinding" contract= "yournamespace.iyourservicecontract" /> </service> </services></SYSTEM.SERVICEMODEL>
Corresponding client config:
<system.serviceModel> <client name= "Default" >< Span class= "PLN" > <endpoint name= "Default" address= binding= "BasicHttpBinding" contract= "yourclientproxynamespace.iyourservicecontract" />< Span class= "PLN" > </client></system.servicemodel
Then only ever change something if you really must! And most of all: never ever let Visual Studio (Add Service Reference) or svcutil.exe
screw up your config! Protect It like the apple of your eye!
Then:if e.g. your data transfer takes more time than the default timeout of 1 minute allows Ng on both the service side and the client side. Do the by defining a custom binding configuration and referencing the from your endpoints-but the change is only that-n OT more! Leave everything else as is, with default values. Don ' t ever change anything unless you absolutely must (and know-what are you ' re-doing, and why are you ' re doing it).
Mind You:the on the sendTimeout
client (time allowed until the whole message has been sent) would correspond to the receiveTimeout
Server-the time allowed for the whole message to come in (see this excellent blog post and this MSDN forum thread for M Ore information)
Service Config:
<system.serviceModel> <bindings> <basicHttpBinding> <binding Name="ExtendedTimeout" ReceiveTimeout="00:05:00" /> </basicHttpBinding> </bindings> <services> <service Name="Yournamespace.yourserviceclass"> <endpoint name= " Default " address=" http://YourServer/ Somevirtualdirectory/yourservice.svc " binding= "BasicHttpBinding" bindingconfiguration = "extendedtimeout" contract= "yournamespace.iyourservicecontract" /> </service> </services> </SYSTEM.SERVICEMODEL>
Corresponding client config:
<system.serviceModel> <bindings> <basicHttpBinding> <binding Name="ExtendedTimeout" Sendtimeout="00:05:00" /> </basicHttpBinding> </bindings> <client Name="Default"> <endpoint name = "Default" address=< Span class= "ATV" > "http://YourServer/SomeVirtualDirectory/YourService.svc" = "BasicHttpBinding" = "extendedtimeout" = "yourclientproxynamespace.iyourservicecontract" /> </client> </system.servicemodel>
As you need other changes, like multiple endpoints on the service side, or local settings like bypassProxyOnLocal
-adapt your config, Do it carefully, step by step, manually, and consider your config a extremely essential part of your whole service-take Care of it, put it in version control etc.
If WCF Service side and Client side config is different?!