3

i'm kinda new to wcf, facing some issues that i wasn't able to find on the web or misunderstood.

<service name="Columba.Services.DataConnector.DataConnectorManager" behaviorConfiguration="ServiceBehavior">
    <endpoint address="net.tcp://localhost:8888/IDataConnectorManager/" binding="netTcpBinding" contract="Columba.Services.Common.Contracts.DataConnector.IDataConnectorManager">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>

   <endpoint address="net.msmq://./private/columba/IQueueItems" binding="netMsmqBinding" bindingConfiguration="MSMQBinding" contract="Columba.Services.Common.Contracts.Delivery.IQueueItems" >
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>

  </service>

what i'm trying to achieve is to change the behaviorConfiguration="ServiceBehavior" to a different behaviorConfiguration (found at serviceBehaviors tag) for only the second endpoint. is it even possible to achieve such functionality?!

The new behavior is configuring serviceCredentials service certificate, but its only needed for the second endpoint.

Thanks in advance guys.

Biryukov Pavel
  • 397
  • 4
  • 18
  • 1
    Possible duplicate of [Different Service behaviors per endpoint](http://stackoverflow.com/questions/12294665/different-service-behaviors-per-endpoint) – tom redfern Feb 15 '16 at 11:42

2 Answers2

5

Create new interface and class from parents:

interface IDataConnectorManager2 : IDataConnectorManager
{}
public class DataConnectorManager2: DataConnectorManager, IDataConnectorManager2 {}

Then create second service in config with newly created class/interface and other behaviour:

<service name = "DataConnectorManager" behaviorConfiguration="behavior1">
 <endpoint address="endpoint1">
<service>
<service name = "DataConnectorManager2" behaviorConfiguration="behavior2">
 <endpoint address="endpoint2">
<service>
Ramunas
  • 1,015
  • 1
  • 12
  • 19
1

Short answer, no - service behavior operates at the service level only.

You can, however, implement an endpoint-level behavior by creating a behavior class direived from BehaviorExtensionElement, and implememting IEndpointBehavior, as described here.

Community
  • 1
  • 1
tom redfern
  • 30,562
  • 14
  • 91
  • 126