Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your question can be divided into multiple parts:</p> <blockquote> <p>Is it OK to hard code address?</p> </blockquote> <p>NO. In the same way we don't hard code connection strings we also don't hard code paths to resources or services (at least not absolute paths). You never know when you would need to change it for any reason - for example to test a new version of the service. Use at least simple app settings if you don't want to use full endpoint configuration.</p> <blockquote> <p>Is it OK to hard code binding and configuration?</p> </blockquote> <p>If you don't expect to change it very often and if you are happy with recompiling and redeploying server and client every time you change it you can hard code it. The API provides this because it is valid use case.</p> <blockquote> <p>Is it OK to share service contracts and data contracts between client and server?</p> </blockquote> <p>Again it depends on the way how you expect the application will grow and how you expect complexity of deployment. Sharing assembly is valid use case if you have full control over both client and server code but you must remember that it introduces tight coupling between your server and client application. Svcutil is tool which helps you generating clients from SOAP services you don't have control over (you don't have their code or they are not written in .NET) or for clients where you want to follow loose coupling with a server. </p> <p>I very often use configuration with shared contract assembly myself = no svcutil.</p> <p>Edit:</p> <p>Anyway there is no technical drawback in coded configuration over XML configuration (some advanced configuration are even not available in XML). If a developer knows WCF he would understand both XML and code. If developer doesn't know WCF he would probably be more satisfied with the code because XML configuration may be hidden from him for a while.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload