none
Error... The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified.

    Question

  • Hi,

     

    I am having a problem with a Duplex WCF Service / Client using NetTcp.

    Everytime I make the call to DuplexChannelFactory.CreateChannel, I get the error "The Address property on ChannelFactory.Endpoint was null.  The ChannelFactory's Endpoint must have a valid Address specified."

    This is the code that I am using to create the DuplexChannel

     

      public class SyncOnDemandProxy : IDisposable
      {
        private readonly InstanceContext _instanceContext;
        private readonly SyncOnDemandRemoteNotificationCallback _syncOnDemandRemoteNotificationCallback;
        private DuplexChannelFactory<ISyncOnDemandContract> _duplexChannelFactory;
    
        public ISyncOnDemandContract Proxy { get; set; }
    
        public SyncOnDemandProxy()
        {
          _syncOnDemandRemoteNotificationCallback = new SyncOnDemandRemoteNotificationCallback();
          _syncOnDemandRemoteNotificationCallback.SyncOnDemandRemoteNotificationReceived += SyncOnDemandRemoteNotificationReceived;
          _instanceContext = new InstanceContext(_syncOnDemandRemoteNotificationCallback);
          CreateProxy(_instanceContext);
        }
    
        protected void CreateProxy(InstanceContext instanceContext)
        {
          _duplexChannelFactory = new DuplexChannelFactory<ISyncOnDemandContract>("*");
          Proxy = _duplexChannelFactory.CreateChannel(instanceContext);
        }
      ..
      ..
      }
    }
    


    My WCF Service's Web.config is as follows:-

     <system.serviceModel>
      <bindings>
       <netTcpBinding>
        <binding name="NetTcp_SyncOnDemandBinding"
             closeTimeout="00:10:00"
             openTimeout="00:10:00"
             receiveTimeout="00:10:00"
             sendTimeout="00:10:00"
             transactionFlow="false"
             transferMode="Buffered"
             transactionProtocol="OleTransactions"
             hostNameComparisonMode="StrongWildcard"
             listenBacklog="10"
             maxBufferPoolSize="2147483647"
             maxBufferSize="2147483647"
             maxConnections="10"
             maxReceivedMessageSize="2147483647" portSharingEnabled="true">
         <readerQuotas maxDepth="32"
                maxStringContentLength="2147483647"
                maxArrayLength="16384"
                maxBytesPerRead="2147483647"
                maxNameTableCharCount="16384" />
         <reliableSession ordered="true"
                  inactivityTimeout="00:10:00"
                  enabled="true" />
         <security mode="None">
          <transport clientCredentialType="None" protectionLevel="None" />
          <message clientCredentialType="None" />
         </security>
        </binding>
       </netTcpBinding>   
      </bindings>
      
      <behaviors>
       <serviceBehaviors>
        <behavior name="NetTcpBehavior">
         <serviceMetadata/>
         <serviceThrottling maxConcurrentSessions="10000" />
        </behavior>
       </serviceBehaviors>
      </behaviors>
      
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      <services>
       <service name="Eclipse.Synchronisation.WebServices.SyncOnDemandWebService">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcp_SyncOnDemandBinding"
         name="NetTcpSyncOnDemand" contract="Eclipse.Synchronisation.Contracts.ISyncOnDemandContract">
         <identity>
          <dns value="localhost" />
         </identity>
        </endpoint>
        <endpoint binding="mexTcpBinding" name="NetTcpMexSyncOnDemand" address="mex" contract="IMetadataExchange"/>
        <host>
         <baseAddresses>
          <add baseAddress="http://localhost/Eclipse.Synchronisation.WebServices/SyncOnDemandWebService.svc" />
          <add baseAddress="net.tcp://localhost/Eclipse.Synchronisation.WebServices/SyncOnDemandWebService.svc" />
         </baseAddresses>
        </host>
       </service>
      </services>
     </system.serviceModel>
    


    My Client app.config Configuration is as follows:-

     <system.serviceModel>
      <bindings>
       <netTcpBinding>
        <binding name="NetTcp_SyncOnDemand" closeTimeout="00:10:00" openTimeout="00:01:00"
          receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false"
          transferMode="Buffered" transactionProtocol="OleTransactions"
          hostNameComparisonMode="StrongWildcard" listenBacklog="10"
          maxBufferPoolSize="524288" maxBufferSize="10485760" maxConnections="10"
          maxReceivedMessageSize="10485760">
         <readerQuotas maxDepth="32" maxStringContentLength="10485760" maxArrayLength="10485760"
           maxBytesPerRead="4096" maxNameTableCharCount="16384" />
         <reliableSession ordered="true" inactivityTimeout="00:10:00"
           enabled="true" />
         <security mode="None">
          <transport clientCredentialType="None" protectionLevel="None" />
          <message clientCredentialType="None" />
         </security>
        </binding>
       </netTcpBinding>
    
      </bindings>
      <client>
       <endpoint address="net.tcp://localhost/Eclipse.Synchronisation.WebServices/SyncOnDemandWebService.svc"
         binding="netTcpBinding" bindingConfiguration="NetTcp_SyncOnDemand"
         contract="Eclipse.Synchronisation.Contracts.ISyncOnDemandContract" name="NetTcpSyncOnDemand">
        <identity>
         <dns value="localhost" />
        </identity>
       </endpoint>
       
      </client>
     </system.serviceModel>
    


    I have tried changing lots of things in both the web.config and app.config, all without success.

    I have tried using the EndpointName in the constructor call to the Duplex Channel instead of "*", but that didnt make any difference.

    I have checked and double checked my configuration and cannot find anything wrong.

    ALso, out of interest, I also have two other endpoints for other services in the same project, one which uses wsHttpBinding and the other uses basicHttpBinding. Both of these work absolutely fine, but using the Channel and not the DuplexChannel. Unfortunately, the service that I am having problems with has to be Duplex and has to use NetTcp.

    I am just not sure where to go from here.

    ANy help would be very much appreciated.

    If you need details of any of the other code, please let me know and I will be happy to post it.

    Many thanks in advance.

    Simon

    Thursday, June 16, 2011 3:45 PM

Answers

All replies

  • Hello, you mentioned you've tried to use EndpointName in the constructor call to the Duplex Channel instead of "*". Can you make sure you are using the correct name? According to the configuration, the name is "NetTcpSyncOnDemand". Also try to construct the endpoint and bindings in code using this overload of the constructor.
    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
    Windows Azure Technical Forum Support Team Blog
    • Marked as answer by Yi-Lun Luo Wednesday, June 22, 2011 9:16 AM
    Friday, June 17, 2011 2:12 AM
  • Hi,

    Thankyou for the very quick response to my question.

    Yes, I was definitely using the correct endpoint name.

    I tried again and it didnt work.

    However, I tried your second suggestion as follows, and it worked :-)

    var binding = new NetTcpBinding();  
    _duplexChannelFactory = new DuplexChannelFactory<ISyncOnDemandContract>(binding, "NetTcpSyncOnDemand");
    Proxy = _duplexChannelFactory.CreateChannel(instanceContext);
    
    

    Why does this solution work, but calling the constructor without the binding does not - am I doing something wrong?

    Many thanks

    Simon






    Friday, June 17, 2011 5:52 AM