Associate names with the service configuration when you create service behavior, endpoint behavior, and binding configuration

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.

When updating or creating a new service configuration, make sure you set the appropriate attributes to the reference names of service behavior, endpoint behavior and biding configuration.

This is important to make sure the changes to service behavior, endpoint behavior and biding configuration are applied correctly to the WCF service at runtime.

The following code shows how the behaviors and the binding configuration with WebHttpBinding are associated with a service
<system.serviceModel>

 <bindings>
   <webHttpBinding>
    <binding name="*MyWebHttpBinding*" />
   </webHttpBinding>
 </bindings>

 <services>
   <service behaviorConfiguration="*MyServiceBehaviorForWebHttp*" name="Service">
   
    <endpoint address="" behaviorConfiguration="*MyEndpointBehaviorForWebHttp*"
     binding="webHttpBinding" bindingConfiguration="*MyWebHttpBinding*"
     name="*MyEndpointWebHttp*" contract="IService">
     <identity>
      <dns value="localhost" />
     </identity>
    </endpoint>

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
  </services>

  <behaviors>

   <endpointBehaviors>
    <behavior name="*MyEndpointBehaviorForWebHttp*">
     <enableWebScript />
    </behavior>
   </endpointBehaviors>

   <serviceBehaviors>
    <behavior name="*MyServiceBehaviorForWebHttp*">
     <serviceMetadata httpGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>

  </behaviors>
</system.serviceModel>

Last edited Apr 24, 2008 at 12:46 AM by prashantbansode, version 2

Comments

No comments yet.