none
WCF Test Client not working even though machine service is on same machine RRS feed

  • Question

  • Hi,

    I am trying to WcfTestClient.exe provided my Visual Studio to test the WCF service (it is set as discovery service). This services is hosted on same machine where WCF client is residing, but when I try add service "net.tcp://localhost:20000/Radio" I get following error:

    "Error: Cannot obtain Metadata from net.tcp://localhost:25500/Radio If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error    URI: net.tcp://localhost:25500/Radio    Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:25500/Radio'.    <?xml version="1.0" encoding="utf-16"?><Fault xmlns="http://www.w3.org/2003/05/soap-envelope"><Code><Value>Sender</Value><Subcode><Value xmlns:a="http://www.w3.org/2005/08/addressing">a:DestinationUnreachable</Value></Subcode></Code><Reason><Text xml:lang="en-GB">The message with To 'net.tcp://localhost:25500/Radio' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.  Check that the sender and receiver's EndpointAddresses agree.</Text></Reason></Fault>"


    Below is the config file for my service:

    <?xml version="1.0" encoding="UTF-8"?> <configuration> <announcementServiceEndpoint discoveryMulticastAddress="soap.udp://239.255.255.250:9896" /> <serviceDiscoveryConfiguration discoveryCheckInterval="00:00:30" /> <system.serviceModel> <client> <endpoint name="udpDiscoveryEndpoint" kind="udpDiscoveryEndpoint" endpointConfiguration="udpDiscoveryEndpointClient" /> <endpoint name="dispatcherService" address="" binding="netTcpBinding" bindingConfiguration="tcpBindingConfig" contract="Server.DispatcherService.IDispatcherService" /> </client> <services> <!-- RadioSvc endpoint for receiving commands for the radio service --> <service name="Server.Radio.RadioService" behaviorConfiguration="RadioServiceBehaviour"> <host> <baseAddresses> <add baseAddress="net.tcp://*:20000" /> </baseAddresses> <timeouts openTimeout="00:01:00" closeTimeout="00:00:10" /> </host> <endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpBindingConfig" contract="Server.Radio.IRadioService" behaviorConfiguration="DynamicContactBehaviour" /> <endpoint kind="udpDiscoveryEndpoint" endpointConfiguration="udpDiscoveryEndpointSvc" /> </service> <service name="Radio.Web.RadioService" behaviorConfiguration="RadioApiServiceBehaviour"> <host> <baseAddresses> <add baseAddress="http://*:20001" /> </baseAddresses> <timeouts openTimeout="00:01:00" closeTimeout="00:00:10" /> </host> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <endpoint address="web" binding="basicHttpBinding" name="web" contract="Server.Radio.Web.IRadioService" bindingConfiguration="basicHttpBinding" behaviorConfiguration="WebEndpointBehaviour" /> </service> </services> <bindings> <netTcpBinding> <binding name="tcpBindingConfig" receiveTimeout="00:10:00" sendTimeout="00:00:08" openTimeout="00:00:08" maxReceivedMessageSize="4194304" maxBufferSize="4194304"> <security mode="None" /> </binding> </netTcpBinding> <basicHttpBinding> <binding name="basicHttpBinding"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="RadioServiceBehaviour"> <!--<monitoredRadioServiceBehaviour/>--> <standaloneRadioServiceBehaviour /> <!--<xslt serviceTransform="RadioServiceTransforms.xslt" callbackTransform="RadioServiceCallbackTransforms.xslt"/>--> <serviceDiscovery> <announcementEndpoints> <endpoint kind="udpAnnouncementEndpoint" endpointConfiguration="udpAnnouncementEndpointSettings" /> </announcementEndpoints> </serviceDiscovery> </behavior> <behavior name="RadioApiServiceBehaviour"> <standaloneRadioServiceBehaviour /> <serviceMetadata httpGetEnabled="True" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="WebEndpointBehaviour"> <dynamicDataContractEndpointBehaviour assemblyQueryString="*abc.dll" /> <sessionEndpointBehaviour /> </behavior> <behavior name="DynamicContactBehaviour"> <dynamicDataContractEndpointBehaviour assemblyQueryString="*abc.dll" /> </behavior> </endpointBehaviors> </behaviors> <standardEndpoints> <udpDiscoveryEndpoint> <standardEndpoint name="udpDiscoveryEndpointSvc" maxResponseDelay="00:00:00.800" multicastAddress="soap.udp://239.255.255.250:9996"> <transportSettings timeToLive="1" /> </standardEndpoint> <standardEndpoint name="udpDiscoveryEndpointClient" maxResponseDelay="00:00:00.800" multicastAddress="soap.udp://239.255.255.250:9896"> <transportSettings timeToLive="1" /> </standardEndpoint> </udpDiscoveryEndpoint> <udpAnnouncementEndpoint> <standardEndpoint name="udpAnnouncementEndpointSettings" maxAnnouncementDelay="00:00:00.800" multicastAddress="soap.udp://239.255.255.250:9996"> <transportSettings timeToLive="1" /> </standardEndpoint> </udpAnnouncementEndpoint> </standardEndpoints> </system.serviceModel> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> </startup> </configuration>

    Can someone help what I am doing wrong. Do I need to change anything in my service config file? I am new to WCF and need load test this WCF service.

    Please help !!!

    Thanks,

    Kushal

    Friday, April 28, 2017 1:57 PM

All replies

  • For adding service reference, you need to expose mex endpoint.

    How did you host Service in code?

    I suggest you try to modify the config like below:

        <system.serviceModel>
          
          <services>
            <service name="Microsoft.Samples.Discovery.CalculatorService"
                     behaviorConfiguration="calculatorServiceBehavior">
              <endpoint address=""
                        binding="netTcpBinding"
                        contract="Microsoft.Samples.Discovery.ICalculatorService"
                        behaviorConfiguration="endpointBehaviorConfiguration" />
              <!-- Add an UdpDiscoveryEndpoint over which the discovery service will listen for discovery request messages. -->
              <endpoint name="udpDiscovery" kind="udpDiscoveryEndpoint" endpointConfiguration="adhocDiscoveryEndpointConfiguration"/>
              <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://*:20000"/>
                <add baseAddress="http://*:20001"/>
              </baseAddresses>
            </host>
            </service>
          </services>
          
          <behaviors>      
            <serviceBehaviors>
              <behavior name="calculatorServiceBehavior">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                <!-- Add ServiceDiscoveryBehavior which enables discovery -->
                <serviceDiscovery>
                  <!-- This section is used to specify where the announcement messages will be sent. If this section is not added, then announcements will not be sent. -->
                  <announcementEndpoints>
                    <endpoint kind="udpAnnouncementEndpoint"/>
                  </announcementEndpoints>
                </serviceDiscovery>
              
              </behavior>
            </serviceBehaviors>
            
            <endpointBehaviors>
              <behavior name="endpointBehaviorConfiguration">
                
                <endpointDiscovery>
                  <!-- The endpoint discovery behavior can be used to enable or disable discovery for a particular endpoint as well as adding scopes. -->
                  <scopes>
                    <add scope="http://www.microsoft.com/building42/floor1"/>
                    <add scope="ldap:///ou=engineering,o=exampleorg,c=us"/>
                  </scopes>
                </endpointDiscovery>
                
              </behavior>          
            </endpointBehaviors>
            
          </behaviors>
          
          <standardEndpoints>
            <udpDiscoveryEndpoint>
              <!-- Specify the discovery protocol version and maxResponseDelay -->
              <standardEndpoint name="adhocDiscoveryEndpointConfiguration" discoveryVersion="WSDiscovery11" maxResponseDelay="00:00:00.600" />  
            </udpDiscoveryEndpoint>
          </standardEndpoints>
        
        </system.serviceModel>
    

    And Host Code:

                ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService));
                serviceHost.Open();
    Then, you could add service reference by "net.tcp://localhost:20000/mex"


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, May 1, 2017 6:13 AM
  • Hi,

    It is running as service in server, not hosted in IIS. I have tried to run the service after addding below in service config. It does not start the service after adding below.

    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
            <host>
    Monday, May 8, 2017 4:00 PM
  • What error did you get?

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 9, 2017 2:26 AM