WCF - Define multiple services in a single APP.Config file?

Posted by Goober on Stack Overflow See other posts from Stack Overflow or by Goober
Published on 2010-04-06T12:15:22Z Indexed on 2010/04/06 13:13 UTC
Read the original article Hit count: 193

Filed under:
|

Scenario

I have a windows forms application. I want to use two different WCF Services that are in no way connected. HOWEVER, I'm not sure how to go about defining the services in my APP.CONFIG file. From what I have read, it is possible to do what I have done below, but I cannot be sure that the syntax is correct or the tags are all present where necessary and I needed some clarification.

Question.

So is the below the correct way to setup two services in A SINGLE APP.CONFIG FILE? I.E:

<configuration>
<system.serviceModel>
<services>

<service>
<!--SERVICE ONE-->
<endpoint>
</endpoint>
<binding>
</binding>
</service>

<service>
<!--SERVICE TWO-->
<endpoint>
</endpoint>
<binding>
</binding>
</service>

</services>
</system.serviceModel>
</configuration>

CODE

<configuration>

<system.serviceModel>

<services>

<!--SERVICE ONE-->
<service>
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="tcpServiceEndPoint"
contract="ListenerService.IListenerService"
name="tcpServiceEndPoint" />

<binding name="tcpServiceEndPoint" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        transactionFlow="false" transferMode="Buffered"  transactionProtocol="OleTransactions"
        hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
        maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
         <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
         <reliableSession ordered="true" inactivityTimeout="00:05:00"
          enabled="true" />
         <security mode="None">
           <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
           <message clientCredentialType="Windows" />
         </security>
       </binding>

</service>

<!--SERVICE TWO-->
<service>
<endpoint address=""
                    binding="netTcpBinding"
                    contract="UploadObjects.IResponseService"
                    bindingConfiguration="TransactedBinding"
                    name="UploadObjects.ResponseService"/>

<binding name="TransactedBinding">
        <security mode="None" />
      </binding>
</service>

</services>

</system.serviceModel>


</configuration>

EDIT

What do the BEHAVIOURS represent? How do they relate to the service definitions?

© Stack Overflow or respective owner

Related posts about wcf

Related posts about Services