title: TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8732
body: <p>I have a wcf service application using windows service.  Additionally, I have a wpf app that connects to the wcf service.  I have been unable to open the wpf program. This is the error I get when I attempt to open the wpf app from Visual Studio by hitting F5 in debug mode:</p>
  
  <pre><code>mscorlib.dll but was not handled in user code
  
  Additional information: Could not connect to net.tcp://localhost:8732/Design_Time_Addresses/NextGenService/SimSession/. The connection attempt lasted for a time span of 00:00:02.2590000. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8732.
  </code></pre>
  
  <p>I do have both Http and Non-http activation options on under the wcf activation node of selected features.  all 3 services to do with net.tcp are running: Net Pipe Listener Adapter, Net.Tcp Listener Adapter, Net.Tcp Port Sharing Service.</p>
  
  <p>app.config for the server:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="logFile" value="C:\ProgramData\SimSci\Log\server.log"/&gt;
      &lt;add key="SecureFolder" value="..\..\..\..\..\SharedComponents"/&gt;
      &lt;!--&lt;add key="logLevel" value="Debug"/&gt;--&gt;
      &lt;!--&lt;add key="VariableConnection" value="Connected"/&gt;--&gt;
    &lt;/appSettings&gt;
  
    &lt;system.diagnostics&gt;
      &lt;sources&gt;
        &lt;!--Add below switch when need trace on developer system  --&gt;
        &lt;!--switchValue="Warning, ActivityTracing"--&gt;
        &lt;source name="System.ServiceModel.MessageLogging"  switchValue="Off"&gt;
          &lt;listeners&gt;
            &lt;add type="System.Diagnostics.DefaultTraceListener" name="Default"&gt;
              &lt;filter type=""/&gt;
            &lt;/add&gt;
            &lt;add name="ServiceModelMessageLoggingListener"&gt;
              &lt;filter type=""/&gt;
            &lt;/add&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
        &lt;!--Add below switch when need trace on developer system  --&gt;
        &lt;!--switchValue="Warning, ActivityTracing"--&gt;
        &lt;source name="System.ServiceModel" switchValue="Off" propagateActivity="true"&gt;
          &lt;listeners&gt;
            &lt;add type="System.Diagnostics.DefaultTraceListener" name="Default"&gt;
              &lt;filter type=""/&gt;
            &lt;/add&gt;
            &lt;add name="ServiceModelTraceListener"&gt;
              &lt;filter type=""/&gt;
            &lt;/add&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
      &lt;/sources&gt;
      &lt;sharedListeners&gt;
        &lt;add initializeData="..\..\app_messages.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp"&gt;
          &lt;filter type=""/&gt;
        &lt;/add&gt;
        &lt;add initializeData="..\..\app_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp"&gt;
          &lt;filter type=""/&gt;
        &lt;/add&gt;
      &lt;/sharedListeners&gt;
    &lt;/system.diagnostics&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true"/&gt;
    &lt;/system.web&gt;
  
  
    &lt;!-- tempdt timeout values--&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;netTcpBinding&gt;
          &lt;binding name="NetTcpBinding_ISimSession" 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="524288" maxBufferSize="104857600" maxConnections="10" maxReceivedMessageSize="104857600"&gt;
            &lt;readerQuotas maxDepth="32" maxStringContentLength="104857600" maxArrayLength="104857600" maxBytesPerRead="104857600" maxNameTableCharCount="104857600"/&gt;
            &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/&gt;
            &lt;!--&lt;security mode="Transport"&gt;
              &lt;transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /&gt;
              &lt;message clientCredentialType="Windows" /&gt;
            &lt;/security&gt;--&gt;
          &lt;/binding&gt;
        &lt;/netTcpBinding&gt;
      &lt;/bindings&gt;
  
      &lt;services&gt;
        &lt;service name="SimCentral.Server.SimSession"&gt;
          &lt;endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ISimSession" contract="NextGenServices.Contract.ISimSessionService.ISimSession"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost"/&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="net.tcp://localhost:8732/Design_Time_Addresses/NextGenService/SimSession/"/&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, 
            set the value below to false and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="false"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
  
    &lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;
    &lt;/startup&gt;
    &lt;runtime&gt;
      &lt;gcServer enabled="true"/&gt;
      &lt;gcConcurrent enabled="true"/&gt;
    &lt;/runtime&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>app.config for the client</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="ContractType" value="ISimSession"/&gt;
      &lt;add key="ISimSessionNameSpaceVersion" value="http://Invensys.com/SimSci-Esscor/NextGen-Sim/1.0.32.6e"/&gt;
      &lt;add key="Scope" value="aa.soa://SimSession"/&gt;
      &lt;add key="UseASBHost" value="0"/&gt;
      &lt;add key="logFile" value="C:\ProgramData\SimSci\Log\client.log"/&gt;
      &lt;add key="logLevel" value="Debug"/&gt;
    &lt;/appSettings&gt;
  
  
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;netTcpBinding&gt;
          &lt;binding name="NetTcpBinding_ISimSession" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="true" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="104857600" maxConnections="10" maxReceivedMessageSize="104857600"&gt;
            &lt;readerQuotas maxDepth="32" maxStringContentLength="104857600" maxArrayLength="104857600" maxBytesPerRead="104857600" maxNameTableCharCount="104857600"/&gt;
            &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"/&gt;
            &lt;!--&lt;security mode="Transport"&gt;
              &lt;transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /&gt;
              &lt;message clientCredentialType="Windows" /&gt;
            &lt;/security&gt;--&gt;
          &lt;/binding&gt;
        &lt;/netTcpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
        &lt;endpoint address="net.tcp://localhost:8732/Design_Time_Addresses/NextGenService/SimSession/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ISimSession" contract="SimSessionService.ISimSession" name="NetTcpBinding_ISimSession"&gt;
          &lt;identity&gt;
            &lt;dns value="localhost"/&gt;
          &lt;/identity&gt;
        &lt;/endpoint&gt;
      &lt;/client&gt;
    &lt;/system.serviceModel&gt;
  &lt;startup&gt;&lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;&lt;/startup&gt;&lt;/configuration&gt;
  </code></pre>
  
  <p>I tried all the suggestions on the Internet, but none is working for me. Is there anything else that I can do to fix this problem ? Thank you.</p>