Developing Business Logic using the WCF Service Library with VS2K8 and ASP.NET 3.5 - Understanding the WCF Service Library: the app.config file
(Page 3 of 5 )
Every WCF Service must be configured with several settings. Complicated deployments have complicated configurations. As this article assumes that the solution sits on a developer machine, the service model element in "app.config" is defined as follows:
<system.serviceModel>
<services>
<service name="NorthwindBLLService.EmpService"
behaviorConfiguration="NorthwindBLLService.EmpServiceBehavior"> <host>
<baseAddresses>
<add baseAddress="http://localhost:8181/EmpService" /> </baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding"
contract="NorthwindBLLService.IEmpService" /> <endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" /> </service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="NorthwindBLLService.EmpServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="True" /> </behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Make sure that the following is always true to give full details of errors raised during development:
<serviceDebug includeExceptionDetailInFaults="True" />The service gets hosted using the following address:
<add baseAddress="http://localhost:8181/EmpService" />The main endpoint for the above service is defined as follows:
<endpoint address="" binding="wsHttpBinding"
contract="NorthwindBLLService.IEmpService" /> And finally, the service is named as follows:
<service name="NorthwindBLLService.EmpService" behaviorConfiguration="NorthwindBLLService.EmpServiceBehavior"> Depending upon the deployment/hosting requirements, the "app.config" needs to be modified appropriately. It varies greatly from intranet configurations to extranet or even Internet configurations. It could be completely different from the above if the hosting will be on IIS (Web Service) or WAS or Windows Service.
Next: Understanding the WCF Service host >>
More ASP.NET Articles
More By Jagadish Chaterjee