vendredi 27 février 2015

WCF endpoints in SharePoint web.config



I have a SharePoint site that makes calls to a public web API (Melissa Data) using a WCF client. I have the endpoints configured in the web.config like so:



<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="PropertyWSSOAPEndpoint">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://ift.tt/1BJbAoP"
binding="basicHttpBinding" bindingConfiguration="PropertyWSSOAPEndpoint"
contract="MelissaDataPropertyService.IService" name="PropertyWSSOAPEndpoint" />
</client>
</system.serviceModel>


I instantiate my client like so:



MelissaDataPropertyService.ServiceClient PropertyServiceClient = new MelissaDataPropertyService.ServiceClient();


This all works fine and dandy, but I've heard it is bad practice to put site configuration values into the SharePoint IIS web.config. Can someone please explain to me a.) why this is a bad practice, and b.) how to configure and instantiate the WCF client object without using the web.config?








0 commentaires:

Enregistrer un commentaire