Bindings:
Note:
</behavior>
This describes about how to communicate with service.
For
an instance Consider a scenario say, I
am creating a service that has to be used by two type of client. One of the clients
will access SOAP using http and other client will access Binary using TCP. How
it can be done? With Web service it is very difficult to achieve, but in WCF it’s
just we need to add extra endpoint in the configuration file
<system.serviceModel>
<services>
<service
name="MathService"
BehaviorConfiguration="MathServiceBehavior">
<endpoint
address="http://localhost:8090/MyService/MathService.svc"
Contract="IMathService"
binding="wsHttpBinding"/>
<endpoint
address="net.tcp://localhost:8080/MyService/MathService.svc"
Contract="IMathService" binding="netTcpBinding"/>
</service>
</services>
<Behaviors>
<ServiceBehaviors>
<behavior
name="MathServiceBehavior">
<serviceMetadata
httpGetEnabled="True"/>
<serviceDebug
includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
In above instance common behaviors
affect all endpoints globally, service behaviors affect only service-related
aspects, endpoint behaviors affect only endpoint-related properties, and
operation-level behaviors affect particular operations.
Behavior:
In
the below configuration information, I have mentioned the Behavior at Service
level. In the service behavior I have mention the serviceMetadata node with
attribute httpGetEnabled='true'. This attribute will specifies the publication
of the service metadata. Similarly we can add more behavior to the service.
<system.serviceModel>
<services>
<service name="MathService"
BehaviorConfiguration="MathServiceBehavior">
<endpoint address=""
contract="IMathService"
binding="wsHttpBinding"/>
</service>
</services>
<Behaviors>
<ServiceBehaviors>
<behavior
name="MathServiceBehavior">
<serviceMetadata
httpGetEnabled="True"/>
<serviceDebug
includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Note:
Application can be controlled
either through coding, configuring or through combination of both.
Specification mention in the configuration can also be overwritten in code.
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
In above instance common behaviors
affect all endpoints globally, service behaviors affect only service-related
aspects, endpoint behaviors affect only endpoint-related properties, and
operation-level behaviors affect particular operations.
No comments:
Post a Comment