Click here to Skip to main content
15,893,814 members

Why am I getting an exception (TCP error code 10061) when attempting to communicate between 2 applications using WCF?

johnbMA asked:

Open original thread
Hi:

I am trying to use WCF to setup IPC between 2 running windows applications.
I want to start out by saying that I know there are other (better?) ways to implement
this solution. But, due to some pre-existing design considerations/constraints, I'm bound to using:
- netTcpBinding
- DuplexChannelFactory<> to support bidirectional communication

All the applications, services, etc reside on the same machine as we will be
installing everything on a single dedicated piece hardware running MS Windows.


So the schematic kind of looks like this
WPFApp1
(Contains ReportingFacilityInterface definition)
Returns notifications as separate callbacks to WPFApp2
^
|
|
V
ReportingFacilityInterfaceProxy
^
|
|
V
WPFApp2 (needs to call exposed methods on WPF1 ReportingFacilityInterface object)


I've created my WCF "service" class and contracts.
I'm using a proxy dll to facilitate the communication.


Here's the sequence of events:
-----------------------------
1)WPFApp1 starts up and instantiates an instance of the exposed service class

C#
ReportingFacilityInterface = new ReportingFacility.ReportingFacilityInterface(); 

This starts up fine.


2) WPFApp2 startsup and initializes instance of proxy object
C#
reportingFacilityProxy = new ReportingFacilityInterfaceProxy.ReportingFacilityProxy();


This instantiates the proxy object, which results in this getting called:
C#
<pre>reportingFacilityInterface = DuplexChannelFactory<IReportingFacilityInterface>.CreateChannel(objContext, "RPIEndPointConfiguration"); 

This seems to run and return successfuly.


3) WPFApp2 calls a on the object (through the proxy)
C#
reportingFacilityInterface.Initialize(configuration);

I get an exception with the following detail:

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

I examined my current port usage using the CurrPorts application and noticed that port #8732 does is not in the list of currently active/used ports on my machine.


Since I'm pretty green @ the world of WCF, I'm kind of stumped here.
As I mentioned above, all these are running on the same (dedicated) piece of Windows 7 hardware, so permissions/roles should not be an issue.
I think I'm pretty close here, but am just missing something.

Thanks,
JohnB
Tags: C#, .NET, WCF, IPC

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900