none
The communication object cannot be used because it is in the Faulted state.

    Question

  • Hi,

     I am encountering the following exception.

     

    "The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."

     

    The previous thread on this did'nt provide anything conclusive to me so posting it afresh.

     

    So this is how the exception gets thrown. I send a message from client to the service it works fine. I wait for a time period equal to my receiveTimeout and then send the message, it throws the exception. I tried with recivetimeout of 1 and 10 mins it failed in both cases

     

    My WCF service is basically a Message broker which has a callback contract which is oneway. I am not using reliable communication. I tried using it but it made no difference. ALso I am using netTcpBinding and ConcurrencyMode Multiple

     

    I am posting the trace logs for both the service end and client end.

     

    At the client end it gives the following trace

     

    </StackTrace><ExceptionString>System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host</ExceptionString><NativeErrorCode>2746</NativeErrorCode> <Message>The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.</Message><StackTrace> at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()

     

     

    At service side

     

    at System.ServiceModel.Channels.DelegatingConnection.EndRead()

    at System.ServiceModel.Channels.TracingConnection.EndRead()

    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)

    at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()

    at System.ServiceModel.Channels.TracingConnection.WaitCallback(Object state)

    at System.ServiceModel.Channels.SocketConnection.FinishRead()

    at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)

    at System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

    at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)

    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    </StackTrace><ExceptionString>System.ServiceModel.CommunicationObjectAbortedException: A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data. ---&amp;gt; System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request

    --- End of inner exception stack trace ---</ExceptionString><InnerException><ExceptionType>System.Net.Sockets.SocketException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The I/O operation has been aborted because of either a thread exit or an application request</Message><StackTrace> at System.ServiceModel.Channels.SocketConnection.EndRead()

    at System.ServiceModel.Channels.DelegatingConnection.EndRead()

    at System.ServiceModel.Channels.TracingConnection.EndRead()

    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)

    at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()

    at System.ServiceModel.Channels.TracingConnection.WaitCallback(Object state)

    at System.ServiceModel.Channels.SocketConnection.FinishRead()

    at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)

    at System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

    at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)

    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    </StackTrace><ExceptionString>System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request</ExceptionString><NativeErrorCode>3E3</NativeErrorCode></InnerException>

     

    <Message>A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data.</Message><StackTrace> at System.ServiceModel.Channels.SocketConnection.EndRead()

    at System.ServiceModel.Channels.DelegatingConnection.EndRead()

    at System.ServiceModel.Channels.TracingConnection.EndRead()

    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)</StackTrace><ExceptionString>System.ServiceModel.CommunicationObjectAbortedException: A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data. ---&amp;gt; System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request

    --- End of inner exception stack trace ---

    at System.ServiceModel.Channels.SocketConnection.EndRead()

    at System.ServiceModel.Channels.DelegatingConnection.EndRead()

    at System.ServiceModel.Channels.TracingConnection.EndRead()

    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)</ExceptionString><InnerException><ExceptionType>System.Net.Sockets.SocketException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The I/O operation has been aborted because of either a thread exit or an application request</Message><StackTrace> at System.ServiceModel.Channels.SessionConnectionReader.GetPendingMessage()

    at System.ServiceModel.Channels.SessionConnectionReader.EndReceive()

    at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)

    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)

    at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()

    at System.ServiceModel.Channels.TracingConnection.WaitCallback(Object state)

    at System.ServiceModel.Channels.SocketConnection.FinishRead()

    at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)

    at System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

    at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)

    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    </StackTrace><ExceptionString>System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request</ExceptionString><NativeErrorCode>3E3</NativeErrorCode>

     

    <Message>A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data.</Message><StackTrace> at System.ServiceModel.Channels.SessionConnectionReader.GetPendingMessage()

    at System.ServiceModel.Channels.SessionConnectionReader.EndReceive()

    at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)</StackTrace><ExceptionString>System.ServiceModel.CommunicationObjectAbortedException: A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data. ---&amp;gt; System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request

    --- End of inner exception stack trace ---

    at System.ServiceModel.Channels.SessionConnectionReader.GetPendingMessage()

    at System.ServiceModel.Channels.SessionConnectionReader.EndReceive()

    at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)</ExceptionString><InnerException><ExceptionType>System.Net.Sockets.SocketException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The I/O operation has been aborted because of either a thread exit or an application request</Message><StackTrace> at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.EndReceive(IAsyncResult result)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)

    at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)

    at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)

    at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)

    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)

    at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()

    at System.ServiceModel.Channels.TracingConnection.WaitCallback(Object state)

    at System.ServiceModel.Channels.SocketConnection.FinishRead()

    at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)

    at System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

    at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)

    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    </StackTrace><ExceptionString>System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request</ExceptionString><NativeErrorCode>3E3</NativeErrorCode>

     

    <Message>A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data.</Message><StackTrace> at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.EndReceive(IAsyncResult result)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)</StackTrace><ExceptionString>System.ServiceModel.CommunicationObjectAbortedException: A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data. ---&amp;gt; System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request

    --- End of inner exception stack trace ---

    at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.EndReceive(IAsyncResult result)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)</ExceptionString><DataItems><Data><Key>System.ServiceModel.Diagnostics.ExceptionUtility.ExceptionStackAsString</Key><Value>throw

    at System.ServiceModel.Channels.SessionConnectionReader.GetPendingMessage()

    at System.ServiceModel.Channels.SessionConnectionReader.EndReceive()

    at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)

    catch

    </Value></Data></DataItems><InnerException><ExceptionType>System.Net.Sockets.SocketException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The I/O operation has been aborted because of either a thread exit or an application request</Message><StackTrace> at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message&amp;amp; message)

    at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext&amp;amp; requestContext)

    at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext&amp;amp; requestContext)

    at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)

    at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)

    at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)

    at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)

    at System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)

    at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)

    at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)

    at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)

    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)

    at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()

    at System.ServiceModel.Channels.TracingConnection.WaitCallback(Object state)

    at System.ServiceModel.Channels.SocketConnection.FinishRead()

    at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)

    at System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

    at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)

    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

     

     

     

    Tuesday, November 06, 2007 10:59 AM

Answers

  • The server will automatically abort connections over which no message has been received for the duration equal to the receive timeout (default is 10 mins). This is a DoS mitigation to prevent clients from forcing the server to have connections open for an indefinite amount of time.


    Since the server aborts the connection because it has gone idle, the client gets this exception.

     

    You can control how long the server allows a connection to go idle before aborting it by configuring the receive timeout on the server's binding.

    Thanks

    Vish

     

    Tuesday, November 06, 2007 6:02 PM

All replies

  • The server will automatically abort connections over which no message has been received for the duration equal to the receive timeout (default is 10 mins). This is a DoS mitigation to prevent clients from forcing the server to have connections open for an indefinite amount of time.


    Since the server aborts the connection because it has gone idle, the client gets this exception.

     

    You can control how long the server allows a connection to go idle before aborting it by configuring the receive timeout on the server's binding.

    Thanks

    Vish

     

    Tuesday, November 06, 2007 6:02 PM
  •  

    I got the same error as well here. It said The communication object cannot be used because it is in the Faulted state.   Also I already set the receveive timeout to 1 minute. Any idea why this happen?

     

    Kindly advise.

     

    Thanks

    David

    Wednesday, November 07, 2007 9:43 AM
  • Hello,

     

    I have exactly the same thing and I am in the same situation with this error. For me increasing the timeout did not help.

    I have post my scenario here, hoping we could  get a common solution to solve this issue as we are quite many who gets stuck here...

    My cas is that I nedd to keep a critical WCF service alive and accessible all the time..

    my post is at : http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2768613&SiteID=1

     

    hope I could get some answer, I am running out of ideas and lossing my hairs

     

    regards

    serge

     

    Wednesday, January 30, 2008 7:54 PM
  • Friday, May 23, 2008 2:07 PM
  • Make sure that the exception is not happening elsewhere and because you're using ServiceHost inside "using", it appears to be caused by the forced close.  For example:

    try
    {
      using(ServiceHost myService = new ServiceHost())
      {
        myService.Open();    // <-- exception happens here...
      }
    }
    catch(Exception e)
    {
      // ...but down here it's reported as an operation on a faulted state b/c when we left the "using" scope
      // the disposal attempted to close the service.
    }
    • Proposed as answer by Usha Pini Tuesday, November 18, 2008 5:12 PM
    Thursday, July 17, 2008 6:18 PM
  • hi, everyone
    I got the same error.
    I have create a wcf duplex service + silverlight chat project over internet for learning WCF
    It works good except the PollingDuplexHttpBinding.ReceiveTimeout property limited, Its default value is 10 mins and its description in msdn is http://msdn.microsoft.com/en/library/system.servicemodel.channels.binding.receivetimeout(VS.95).aspx, I have try to poll clients in server and try to heart in client, the timeout occur after the time long.
    I recieved the error:
    System.TimeoutException: Receive on local address http://docs.oasis-open.org/ws-rx/wsmc/200702/anonymous?id=cdb43505-008b-4837-9c66-c0700e137920" target="_new">http://docs.oasis-open.org/ws-rx/wsmc/200702/anonymous?id=cdb43505-008b-4837-9c66-c0700e137920 timed out after 00:10:00. The time allotted to this operation may have been a portion of a longer timeout.

    T.R.Vishwanath - MSFT
    how can i disabled the limited?
    My demo site: http://www.shareach.com:81/chat
    It's simple chinese language.

    If anyone have idea, pls inform me , thanks
    Monday, March 23, 2009 7:56 PM
  • Hii

    You can try a couple of things.
    Make sure you firewall isn't blocking the port you service is listening to.
    if you are using Net.Tcp, make sure the related services (Net.Tcp LIstner Adapter, Net.Tcp Port Sharing) have started (Administrative Tools->Services)

    Hope it helps.

    ganny
    Friday, June 05, 2009 10:06 PM
  • Hello,

    Assuming that issue is not caused because of security, check out for the number of allowed connections on NetTcpBinding (i think there is built in limitation to prevent DoS atack when it's deployed on the 'net). This problem's escalates when there is need for high throughput between server and client.

    Increase MaxConnections for the server side NetTcpBinding (Listener).
    For example:

    NetTcpBinding newTcp  = new NetTcpBinding(SecurityMode.None, false);

    newTcpBind.MaxConnections = 1000;

    newTcpBind.ListenBacklog = 1000;

    newTcpBind.ReceiveTimeout = new TimeSpan(0,3,0); // 3 minutes

    .... at this point send "newTcp" to AddServiceEndpoint....

     

    Hope this helps.

    Sloba

    Saturday, June 06, 2009 10:23 PM


  • The authorization policy that was configured was not valid on my dev box. Just commented it out for now and all is well.
    <!--

     

    <add policyType=

    Thursday, July 23, 2009 2:23 AM
  • set the the below things in the Bindings section.It will work.

    closeTimeout="00:01:00" openTimeout="00:10:00"
              receiveTimeout="00:20:00" sendTimeout="00:10:00".

    Thanks
    Ravi
    Friday, January 08, 2010 1:13 PM
  • change the using statement with the try, catch block so that u can know what type of exception u r dealing with...In my case i was having problem with my connection string. I was working good on aspnet server, but i deployed it on iis due to sql authentication it could not access the database so I have to edit the connection string to make it work...
    Friday, April 02, 2010 4:15 AM
  • Hi:

    I changed my:

    try
    {
     using(ServiceHost myService = new ServiceHost())
     {
      myService.Open();  // <-- exception happens here...
     }
    }
    catch(Exception e)
    {
     ...
    }

    to:

    using(ServiceHost myService = new ServiceHost())
    {
     try
     {
      myService.Open();  // <-- exception happens here...
     }
     catch(Exception e)
     {
      ...
     }
    }
    

    And got a completely different message...

    I think that is what Praneeth is saying.

    Phil


    PHuhn
    Sunday, July 11, 2010 3:00 AM
  • are you able to acces your service with internet explorer and having the service information page displayed ?

    regards

    Serge


    Your knowledge is enhanced by that of others.
    Monday, July 12, 2010 9:28 PM
  • Hi:

    I am just saying that I stepped thru the code and at the point of the catch the exception was different than one I was receiving with the catch around the using.

    The dispose that is invoked via the using causes another error.  You really want to resolve the first error.

    Phil


    PHuhn
    • Edited by P.Huhn Tuesday, July 20, 2010 2:03 AM further claification
    • Proposed as answer by franciscoarmando Tuesday, August 17, 2010 4:50 PM
    Thursday, July 15, 2010 1:11 PM
  • Hi 

     

    I had the same error, it may be stupid but worked for me

     

    I had a proxy, so disable it and voila

     

    Hope it works for some body!

    Tuesday, August 17, 2010 4:52 PM
  • I was experiencing a similar issue, where after the ReceiveTimeout expired (default is 10 minutes), the channel would go into fault mode, and any subsequent calls would generate the error message of this post's title. I my case I was calling one service from another.

    The solution for me was to call [clientobject].Open() after creating the client to go from state 'Created' to 'Open', then   properly close the channel by calling [clientobject].Close() when I was done with it, to go from state 'Open' to 'Closed'. Despite what the documentation says, I found that calling .Close() on an object in state 'Created' will leave it in state 'Created' and not close it.

    So far, I haven't expriened any issues since this change.

    • Proposed as answer by AFischbein Thursday, January 27, 2011 6:13 PM
    Tuesday, November 16, 2010 10:19 PM
  • This last tip worked for me.
    Thursday, January 27, 2011 6:07 PM
  • In my case, Security certificate was faulty. I hope it helps someone.
    Satjinder
    Friday, June 24, 2011 4:51 AM
  •  try
            {
              client.Close();
            }
    
            catch
            {
                      
    }
            finally
            {
              client.Abort();
            }

    Thursday, July 07, 2011 4:28 AM
  • The connection abort can be triggered artificially if there is a significant discrepancy between the client and server system clocks.  I encountered this issue in a company training environment where a client virtual machine was synchronizing its time with the host; whereas the server virtual was not.  After a while the times drifted so far apart that the client start throwing the '...channel is in a faulted state' error.

     

    Thanks

    sdshan 


    • Edited by SDShan Monday, December 12, 2011 9:12 PM
    • Proposed as answer by AlexGotardi Monday, March 10, 2014 9:56 PM
    Monday, December 12, 2011 9:11 PM
  • I'm running into this problem, too, and don't recall ever having encountered it before.  Once it is in the faulted state, how do you get it out of that?

    Rod

    Tuesday, March 06, 2012 5:58 PM
  • When a commucation chanel is in fault state in cannot be used any more so you should call the abord method to close the chanel then reopen it.

    serge


    Your knowledge is enhanced by that of others.

    Tuesday, March 06, 2012 6:37 PM
  • When a commucation chanel is in fault state in cannot be used any more so you should call the abord method to close the chanel then reopen it.

    serge


    Your knowledge is enhanced by that of others.


    Thank you, Serge.

    Rod

    Tuesday, March 06, 2012 7:30 PM
  • you welcome,

    Here is a sample on what I am doing in case of failure and so far works ok

     /// <summary>
            /// Try to open the specified service and try to recover it if required.
            /// </summary>
            /// <param name="service">The service to open.</param>
            /// <param name="throwOnError">Indicates if an exception must be thwown on error.</param>
            /// <returns><c>true</c> if <paramref name="service"/> could be opened; <c>false</c> if <paramref name="service"/> has been set to <c>null</c> and needs to be re-created.</returns>
            private bool CheckService(bool throwOnError)
            {
                // Do nothing the service is not yet created.
                if (_service == null)
                    return false;
    
                try
                {
                    switch (_service.State)
                    {
                        case CommunicationState.Faulted:
                            _service.Abort();
                            _service = CreateService(_endPoint);
                            _service.Open();
                            break;
                        case CommunicationState.Opened:
                            //No need to close an open service ( CAL )
                            //_service.Close();
                            //_service.Open();
                            break;
                        case CommunicationState.Closed:
                            _service = CreateService(_endPoint);
                            _service.Open();
                            break;
                        case CommunicationState.Created:
                            _service.Open();
                            break;
                    }
                }
                catch
                {
                    if (_service != null && _service.State == CommunicationState.Faulted)
                        _service.Abort();
                    _service = null;
                    if (throwOnError)
                        throw;
                }
    
                return _service != null;
            }

    if it was helpful thanks to vote :-)

    Your knowledge is enhanced by that of others.

    Wednesday, March 07, 2012 5:49 AM
  • Thanks, I'll give what you've specified a try.  One thing, though, your comments at the beginning of your CheckService() method say you're passing in a service to test, but your parameter list doesn't have that (all it has is throwOnErrro).

    Rod

    Wednesday, March 07, 2012 5:57 PM
  • Sorry do not pay attntion to comment, copy Paste effect on lazy person :-)

    serge


    Your knowledge is enhanced by that of others.

    Wednesday, March 07, 2012 6:54 PM
  • I would like to add something which may effect others, trying to solve this problem.  The WCF service I've written uses TCP, rather than HTTP.  Since we have Windows 2003 R2 Servers onsite, and because IIS doesn't support hosting a WCF service which uses TCP as the transport protocol, I had to write a Windows service in order to host the service, which runs my WCF service.  When using InstallUtil.exe to uninstall the service, and restart it again, remember to go into the server's Services applet, to restart the Windows service that hosts your WCF service.


    Rod

    Tuesday, September 18, 2012 7:12 PM
  • We've encountered this error again, but what makes it frustrating is that it's hard to reproduce. Last week 2 users encountered it, but I couldn't duplicate the error on my development box.

    However, I do have a question which I wonder if this effects this situation. Both users have iPhones. They had their phones plugged into the PC's recharging the phones. Could the iPhone software be doing anything that might interfere with network communications?


    Rod

    Monday, February 24, 2014 2:58 PM