locked
Can add one Service Reference for multiple WCF Service Contracts RRS feed

  • Question

  • Hello there,

    I have three different projects:
    1. WCF Service Library, have multiple Service contracts defined
    2. Windows Service for hosting above WCF Service (different ServiceHost opened for different services)
    3. Client - Console Application for Testing

    The App.Config in WCF Service Library is as follows:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

    <system.serviceModel>
    <bindings>
    <wsHttpBinding>
    <binding name="wsHttp" maxReceivedMessageSize="50000000" maxBufferPoolSize="50000000" messageEncoding="Mtom">
    <readerQuotas maxDepth="500" maxStringContentLength="500000000" maxArrayLength="500000000"
    maxBytesPerRead="500000000" maxNameTableCharCount="500000000" />
    </binding>
    </wsHttpBinding>
    </bindings>

    <services>
    <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
    name="ReportingComponentLibrary.TemplateService">
    <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateService" bindingConfiguration="wsHttp" >
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
    <host>
    <baseAddresses>
    <add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateService/" />
    </baseAddresses>
    </host>
    </service>

    <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
    name="ReportingComponentLibrary.TemplateReportService">
    <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateReportService" bindingConfiguration="wsHttp" >
    <identity>
    <dns value="localhost" />
    </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
    <baseAddresses>
    <add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateReportService/" />
    </baseAddresses>
    </host>
    </service>

    </services>

    <behaviors>
    <serviceBehaviors>
    <behavior name="ReportingComponentLibrary.TemplateServiceBehavior">
    <serviceMetadata httpGetEnabled="True"/>
    <serviceDebug includeExceptionDetailInFaults="True" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    </system.serviceModel>
    </configuration>
    And App.Config in Windows Service is same as above.

    Now in my client application, I need to consume methods from both TemplateService and TemplateReportService.

    So, I can always two different Service References as:

    http://localhost:8080/ReportingComponentLibrary/TemplateService/ and

    http://localhost:8080/ReportingComponentLibrary/TemplateReportService/

    This is all working fine.

     

    But I was wondering if there is any way by which I need to add only one reference in client app and

    I can call methods from both the services.

    Thank you!


    Dream Big!
    Tuesday, November 3, 2009 9:43 AM

Answers

All replies