[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Unable to use use WCF from a windows service

Posted on 2011-09-05
6
Medium Priority
?
2,303 Views
Last Modified: 2012-06-27
I have a windows service and I wanted to add capability to send messages from this service to a terminal.
The problem is that I get the following error when I try to create a channel from my windows service:

"There was no endpoint listening at net.pipe://localhost/8084/MessageRecipient that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

However, I verified that using the same code from another terminal I can send messages to the listener terminal shown above.

Following is the code I am using to send the message. The number in the code below corresponds to the process id of the terminal. For simplicity it's shown hardcoded.


string addr = "net.pipe://localhost/8084/MessageRecipient";

ChannelFactory<SMS_svc.WCF.IMessageLogger> factory =
                            new ChannelFactory<IMessageLogger>(
                            new NetNamedPipeBinding(),
                            new EndpointAddress(addr));

            SMS_svc.WCF.IMessageLogger proxy = factory.CreateChannel();
            proxy.LogMessage(msg);
            factory.Close();

Open in new window

0
Comment
Question by:rudy2024
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 8

Accepted Solution

by:
guvera earned 750 total points
ID: 36483840
Hi,

WCF error "No end point listening at net.pipe://server name:port/service name that could accept the message
Often, While having client and server communication via WCF, one of the typical error that is received is no endpoint is listening. I am blogging the error and resolution for the benefits of all blog readers

Error : There was no endpoint listening at net.pipe://servername:portnumber/ that could accept the message.This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Resolution: If you get above error, ensure to follow the below steps
Step 1. Ensure you are pinging the server only if it is started. Normally, this is a typical issue while accessing the service, client pings the server even if it is not started.
Step 2. Ensure that config file in both client and server does not have different address.
Step 3. netpipe/named pipe only works if client and server resides in same machine.Use netTcp binding incase they are not in same machine or if there is any chances in future that both of them does not resides in same machine.

Also, ensure that your IP is been correctly accesed via the client. Normally, this does not happen if you are using load Balancing techniques provider the hardware components.
 
Also Check out the below links

  http://social.msdn.microsoft.com/Forums/en/wcf/thread/7b2739d6-48c5-401b-b9b4-eb1aa3a9b434

Regards
Guvera
0
 

Author Comment

by:rudy2024
ID: 36483945
Thanks Guvera.  I am already following the 3 steps  you descibe.  The code works fine from console but doesn't work from windows service.  The link you sent me helps but does not give code solutions.  It mentions that "impersonation restrictions for netNamedPipeBinding" so maybe that's my issue; however, I don't know how to solve that.  Also towards the end of that link it says to "Check if "Net.Pipe Listener Adapter" service is running in Services management console".  I checked and it was disabled, so I enabled it and tried starting it but got the error message "Windows could not start the Net.Pipe Listener Adapter service on Local Computer.  Error 1075: The dependency service does not exist or has been marked for deletion".
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 36484126
can you run from windows service as specified user instead of systEM?

try it first
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:rudy2024
ID: 36484234
No luck either.  I opened services.msc, clicked properties of my service the chose "Log On" tab and selected "This account" then specified my same login and pw.
Still get same error.
0
 
LVL 23

Assisted Solution

by:Snarf0001
Snarf0001 earned 750 total points
ID: 36484404
The error above looks like the wcf service is failing to start in the windows service for some reason.
Even try / catch on wcf often leads to beyond useless error messages, I've had the best luck setting up a trace.

http://msdn.microsoft.com/en-us/library/ms733025.aspx

This logs all the service events to a trace file, you can look for errors in there and they usually pinpoint exactly what the problem is.
0
 

Author Closing Comment

by:rudy2024
ID: 36562710
Sorry for my delayed response.  I decided to install the service on the server that it will be running and I didn't have any issue there.  So for tests on my PC, it's ok to run my service as console and as service it works well on my server. I don't know why I can't connect a listener on my PC.  Anyway, for now the problem is solved.

Snarf,
I obtained the error log and even though it was really long, it basically ended up showing the same error message.  This trace is mainly helpful to know what methods got called but I already knew that.  It doesn't specify any root cause.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question