WCF supports a diversity programming methods. This article discusses the three most common methods of developing WCF services.
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.serviceModel>
<services>
<service name="MyWCFService" behaviorConfiguration="returnFaults">
<endpoint contract="IMyWCFService" binding="wsHttpBinding" address="http://localhost:1038/WCFDemoService/service.svc"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceMetadata httpGetEnabled="true"></serviceMetadata>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
|
The best approach for developing a service is normally a combination of all three methods. But we need to know how the execution order occurs.
First, attributes are applied.
Second, configuration settings are applied. This will override the attributes if there is a conflict.
Finally, the code is executed.
Hope this helps to clear up the basics of WCF Programming Methods.