0

I'm trying to implement simple wcf service. I think that my server and client side endpoints points are set correctly. On debugging I can see that my service returns data properly but when it comes to display on the screen (simple console application is the client of the service) it says

The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.

 class Program
    {
        static void Main(string[] args)
        {
            string endPoint = ConfigurationManager.AppSettings["BookServiceActiveEndPoint"];
            IBookService proxy = new ChannelFactory<IBookService>(endPoint).CreateChannel();

            // this is where breaks    
            Console.WriteLine(proxy.GetBookDetails("TestBookTitle")); /
            Console.ReadLine();
        }
    }

any ideas where to look for further info?

wcf host is website and solution has multiple startup projects

 - webservices.host  (website) 
 - webservices.consoletests
user2783193
  • 992
  • 1
  • 12
  • 37

1 Answers1

2

This can be caused by a lot of problems, some I've encountered are:

  • Problems with serialization/deserialization
  • Endpoint configuration issues
  • app pool has terminated (ex, when a stackoverflowexception is thrown)
  • tons more

so the best solution is enable tracing and look at the trace logs. I won't try to explain something that's already well explained in the web so I'll just give you a few links:

Usually, it is enough to enable tracing on your web server. However, there might be (very rare) cases where you won't find anything wrong in the server trace logs. In this case, you might also want to enable tracing in the client (same procedure, if you have a .NET client).

Community
  • 1
  • 1
Jerahmeel
  • 620
  • 4
  • 11