none
WCF Net.Tcp 10061 error on WinStore client

    Question

  • I have a WCF Class Library running via "net.tcp" using the port 8523 under "WCF Service Host" in Windows 7 Pro.

    I have 2 clientes, one running Windows 7 Pro and the other Running Windows 8 Pro.

    The first client is a Windows Forms app and the second is a Windows Store app.

    The issue:

    When I run the WinForms client everything Works fine.

    When I run the WinStore client i get this message:"

    Could not connect to net.tcp://localhost:8523/kiss_ihm_RemoteService. The connection attempt lasted for a time span of 00:00:02.1209960. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8523.

    "

    My server config code is:

    <?xml version="1.0"?>
    <configuration>
     
      <system.web>
        <compilation debug="true"/>
      </system.web>
      
      <system.diagnostics>
        <sources>
          <source propagateActivity="true" name="System.ServiceModel" switchValue="Information,ActivityTracing">
            <listeners>
              <add type="System.Diagnostics.DefaultTraceListener" name="Default">
              </add>
              <add name="ServiceModelTraceListener">
              </add>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add initializeData="C:\AETteam\aetDES01\kiss-ihm_Fonte\kiss-ihm_RemoteService\Web_tracelog.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
          </add>
        </sharedListeners>
        <trace autoflush="true" />
      </system.diagnostics>
      
      <system.serviceModel>
        <services>
          <service behaviorConfiguration="Service1Behavior" name="kiss_ihm_RemoteService.kiss_ihm_RemoteService">
            <endpoint address="" binding="netTcpBinding" bindingConfiguration="" contract="kiss_ihm_RemoteServiceObjects._aetclsIObjProcess">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://localhost:8523/kiss_ihm_RemoteService" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>  
            <behavior name="Service1Behavior">
              <serviceMetadata httpGetEnabled="false" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration> 

    My WinStore client code is:

    Protected Async Sub subA(ByVal processo As String) 'net.tcp://192.168.212.69/kiss_ihm_RemoteService/mexTcp

    Try

    Dim a AsNew kiss_ihm_View_WinStore.kiss_ihm_RemoteService._aetclsObjProcess Dim b AsNew kiss_ihm_View_WinStore.kiss_ihm_RemoteService._aetclsIObjProcessClient a = Await b.selectFullAsync(processo) 'Here is where the exception is thrown Dim gvi As GridViewItem = New GridViewItem() Dim spa As StackPanel = New StackPanel() spa.Children.Add(New TextBlock() With {.Text = a.idProcess}) spa.Children.Add(New TextBlock() With {.Text = a.processName}) gvi.Content = spa itemGridView.Items.Add(gvi) Catch ex AsException

    Debug.WriteLine("Error: " & ex.Message) Finally End Try End Sub


    The trace file does not show any exception data...

    I don't have any idea about to solving this problem...

    Anyone can help-me?

    Thanks.



    Monday, May 20, 2013 6:23 PM

Answers

  • You say you're trying to access a WCF service hosted on a Windows 7 machine from a Windows 8 Store app, but your error says that the service is hosted on the same Windows 8 machine (notice the localhost and 127.0.0.1 addresses):

    Could not connect to net.tcp://localhost:8523/kiss_ihm_RemoteService. The connection attempt lasted for a time span of 00:00:02.1209960. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8523.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


    Monday, May 20, 2013 9:10 PM
    Moderator
  • Is the service still on the same system as the Windows Store app?

    Windows Store apps cannot make network connections back to the same system. This can be overridden for debugging purposes (and Visual Studio will default to doing so), but not for production.

    See Troubleshooting and debugging network connections and How to enable loopback and troubleshoot network isolation

    --Rob


    Tuesday, May 21, 2013 5:22 PM
    Owner
  • Is the service still on the same system as the Windows Store app?

    Windows Store apps cannot make network connections back to the same system. This can be overridden for debugging purposes (and Visual Studio will default to doing so), but not for production.

    See Troubleshooting and debugging network connections and How to enable loopback and troubleshoot network isolation

    --Rob



    Thanks a lot!!!

    I corrected the error by adding the "Private Networks (Client & Server)" capability in the "Package.appxmanifest" of the Windows store application (Client).

    Answering you,

    I have the WCF Service running under simulation (WCF Service Host) in a Windows server 2008R2 (the last homologated version o Windows for some vendor's applications in my system).

    The client applications are running under Windows 7 pro (Client 1) and Windows 8 pro tablet (client 2)

    Tuesday, May 21, 2013 8:03 PM

All replies

  • You say you're trying to access a WCF service hosted on a Windows 7 machine from a Windows 8 Store app, but your error says that the service is hosted on the same Windows 8 machine (notice the localhost and 127.0.0.1 addresses):

    Could not connect to net.tcp://localhost:8523/kiss_ihm_RemoteService. The connection attempt lasted for a time span of 00:00:02.1209960. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8523.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


    Monday, May 20, 2013 9:10 PM
    Moderator
  • The error stopped when I changed the baseaddress from

    <add baseAddress="net.tcp://localhost:8523/kiss_ihm_RemoteService" />

    to

    <add baseAddress="net.tcp://192.168.212.69:8523/kiss_ihm_RemoteService" />

    The static internal IP of the server...

    but now I'm with another issue...

    The service Works fine using the "WCF Test Client" tool. but still not working in my cliente app. Giving the message:

    Could not connect to net.tcp://192.168.212.69:8523/kiss_ihm_RemoteService. The connection attempt lasted for a time span of 00:00:00.1060553. TCP error code 10013: An attempt was made to access a socket in a way that is forbidden by its access permissions 192.168.212.69:8523.

    Tuesday, May 21, 2013 5:08 PM
  • Is the service still on the same system as the Windows Store app?

    Windows Store apps cannot make network connections back to the same system. This can be overridden for debugging purposes (and Visual Studio will default to doing so), but not for production.

    See Troubleshooting and debugging network connections and How to enable loopback and troubleshoot network isolation

    --Rob


    Tuesday, May 21, 2013 5:22 PM
    Owner
  • Is the service still on the same system as the Windows Store app?

    Windows Store apps cannot make network connections back to the same system. This can be overridden for debugging purposes (and Visual Studio will default to doing so), but not for production.

    See Troubleshooting and debugging network connections and How to enable loopback and troubleshoot network isolation

    --Rob



    Thanks a lot!!!

    I corrected the error by adding the "Private Networks (Client & Server)" capability in the "Package.appxmanifest" of the Windows store application (Client).

    Answering you,

    I have the WCF Service running under simulation (WCF Service Host) in a Windows server 2008R2 (the last homologated version o Windows for some vendor's applications in my system).

    The client applications are running under Windows 7 pro (Client 1) and Windows 8 pro tablet (client 2)

    Tuesday, May 21, 2013 8:03 PM