tags:

views:

663

answers:

1

Hello there,

I have two base addresses defined in my WCF Service config file:

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

  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
        propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="C:\WCF Service Logs\app_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelTraceListener" traceOutputOptions="DateTime, Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>

  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="netTcp" maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000">
          <readerQuotas maxDepth="500" maxStringContentLength="50000000" maxArrayLength="50000000"
                        maxBytesPerRead="50000000" maxNameTableCharCount="50000000" />
          <security mode="None"></security>
        </binding>
      </netTcpBinding>
    </bindings>

    <services>
      <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
        name="ReportingComponentLibrary.TemplateReportService">
        <endpoint address="TemplateService" binding="netTcpBinding" bindingConfiguration="netTcp"
          contract="ReportingComponentLibrary.ITemplateService"></endpoint>
        <endpoint address="ReportService" binding="netTcpBinding" bindingConfiguration="netTcp"
          contract="ReportingComponentLibrary.IReportService"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>

        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8001/TemplateReportService" />
            <add baseAddress="http://localhost:8181/TemplateReportService"  />
          </baseAddresses>
        </host>
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="ReportingComponentLibrary.TemplateServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

And although I have set endpoint binding as netTcpBinding,
I am only able to access my WCF service with base address:
http://localhost:8181/TemplateReportService and not with
net.tcp://localhost:8001/TemplateReportService

How can I make my service access with netTcp address?

+2  A: 

You defined a Net.TCP base address to be:

net.tcp://localhost:8001/TemplateReportService

Your endpoints with Net TCP are:

<endpoint address="TemplateService" 

and

<endpoint address="ReportService" 

So their complete service address will be "netTcp base address" + "relative address as defined on the <endpoint> element" - this gives:

net.tcp://localhost:8001/TemplateReportService/TemplateService

and

net.tcp://localhost:8001/TemplateReportService/ReportService

respectfully.

Can you use them at these addresses??

Also - you defined a "mex" (metadata exchange) endpoint for the HTTP protocol - that's why you can see something when you navigate to the HTTP address. But you did not specify a MEX endpoint for netTcp.

marc_s
Thank you Marc, So does it mean that even if I have set netTcpBinding for both the endpoints, but if I have MetaData exposed for HttpBinding, it will expose the service at Http address.
inutan
It will expose the metadata for the service at the http address - which means you can only navigate there with your browser. The NetTcp endpoints are active and ready to be used - you just can't get anythign in a browser by going there....
marc_s