Home » .Net FrameworkRSS

WCF Error at Cleint: WCFClient stops intermittently on Duplex Channel

I have written a WCFService and WCFClient working on Duplex Channel on netTCPBinding. It is working fine for some time, after that WCFClient stops the channelling intermmitently and one of the errors as shown below:

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

these services are installed in different boxes, but it works fine these are on a single box. Please let me know if anyone has come across this problem.

 

38 Answers Found

 

Answer 1

To find out why the channel  faulted, you'll need to turn on tracing and then reproduce the situation for the fault. To turn on tracing, see this post: http://blogs.catalystss.com/blogs/scott_seely/archive/2007/09/28/205.aspx.
 

Answer 2

Scott, thanks for information and your interest.

Please help me further....

My Tracelog is already ON. My receiveTimeOut is "Infinite" in config files

Please find the below exception thrown:

<E2ETraceEventxmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">

<Systemxmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">

<EventID>131075</EventID>

<Type>3</Type>

<SubTypeName="Error">0</SubType>

<Level>2</Level>

<TimeCreatedSystemTime="2007-11-02T12:47:06.4713996Z" />

<SourceName="System.ServiceModel" />

<CorrelationActivityID="{00000000-0000-0000-0000-000000000000}" />

<ExecutionProcessName="CorpNetWCFService"ProcessID="6504"ThreadID="6" />

<Channel/>

<Computer>VM</Computer>

</System>

<ApplicationData>

<TraceData>

<DataItem>

<TraceRecordxmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"Severity="Error">

<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>

<Description>Throwing an exception.</Description>

<AppDomain>CorpNetWCFService.exe</AppDomain>

<Exception>

<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>

<Message>The socket connection was aborted. This could be caused by an error  processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'.</Message>

<StackTrace>

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

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

at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.HandleRead()

at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.OnAsyncReadComplete(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.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'. ---&amp;gt; System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

--- 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>An existing connection was forcibly closed by the remote host</Message>

<StackTrace>

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

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

at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.HandleRead()

at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.OnAsyncReadComplete(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: An existing connection was forcibly closed by the remote host</ExceptionString>

<NativeErrorCode>2746</NativeErrorCode>

</InnerException>

</Exception>

</TraceRecord>

</DataItem>

</TraceData>

</ApplicationData>

</E2ETraceEvent>

 

Answer 3

Hi,

         I am in a little urgent to resolve this issue... can u plz help me if anyone has come across this kind of problem...

Scott, looks like you have done some great work in WCF. can u plz help/direct me to resolve this issue.

Thanks in advance,

Naveen

 

Answer 4

Naveen, can you check if there are any other errors reported in the traces.

Dinesh.

 

Answer 5

Naveen,

What is happening here is the remote host is choosing to close the connection. No matter how long the client is willing to keep the connection open, it can not influence the server to make the same choice. If you control the server, you need to increase it's timeouts as well. The other option is to detect the condition of 'server went away' and reestablish the connection.

 

Answer 6

Hi Scott,

I am also facing the same issue with WCF Duplex implementation. I have made changes in server configuration and set the timeout values to a greater value(5 hours). It does not help. Connection between server and clinet is getting dropped around after 10 minutes. I found an article which was saying that WCF has a bug with Timeout settings, ReceiveTimeout is overriding other timeout attributes. As per the suggestion, I treid to set ReceiveTimeout to "Infinite" to keep the socket open even if there is an inactivity of few hours. This is working on one of my servers but not with other two. If I keep polling from WCF client, it works. I am not able to find out the root cause behind the issue. It would be great if you can help me out to find out the exact problem. I am clueless....

Thanks in advance..

Vikas Sirohi

 

Answer 7

Hi Vikas,

  Can you please post your config files?

Thanks,

Pradnya

 

Answer 8

  <system.serviceModel>
        <bindings>
             <basicHttpBinding>
                <binding name="BasicHttpBinding_IMSAMServiceContract" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="Infinite" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
            <netTcpBinding>
                <binding name="NetTcpBinding_IServiceContract" closeTimeout="00:10:00"
                    openTimeout="00:10:00" receiveTimeout= "Infinite" sendTimeout="00:10:00"
                    transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="Infinite"
                        enabled="true" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://ENDPOINT"
                binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IServiceContract"
                contract="IServiceContract" name="NetTcpBinding_IServiceContract">
                <identity>
                    <servicePrincipalName value="host/HOSTNAME" />
                </identity>
            </endpoint>
            <endpoint address="http://ENDPOINT"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMSAMServiceContract"
                contract="IMSAMServiceContract" name="BasicHttpBinding_IMSAMServiceContract" />
        </client>
    </system.serviceModel>
 

Answer 9

Did this issue ever get resolved, or are you still hitting it?

-James

 

Answer 10

Hi,

 It didn't get resolved by default settings, but I had an workaround to get this working. I have written a small thread starts when WCFClient opens a duplex  channel at WCFService and thread will keep pinging WCFClient for some interval (around 5mins) to keep the channel  alive. This has been very consistent now.

 I also tried to capture several communication states ( like Faulted, Closing) and tried to handle in event handlers but could not achieve the end result.

  As per my observation, ReceiveTimeOut = Infinite works very well if WCFClient & WCFService are in same network. But, this problem is consistent across networks.

James, please let us know if you have any clue.

Please keep update us if anyone has got the resolutions for this.

~Naveen

 

Answer 11

Service Model idles out connections using the ReceiveTimeout. What this means is that if there is no application activity within the ReceiveTimeout, Service Model will abort the session.

ReceiveTimeout defaults to 10 minutes which is probably why you saw the abort in 10 minutes.

Are you saying you increased ReceiveTimeout to Infinite and still got a 10 minute abort?

 

Answer 12

Yes, Even if you set the ReceiveTimeout and InactivityTimeout to "Infinite", channel  would be closed after 10 minutes(around).

 

Answer 13

Hello,

I am facing to the exact situation..

I have different WCF services hosted under IIS as WAS and accessing them through TCP.

I am using for soime of them callback to my client application..

my services binding configuration asre as follow :

Code Snippet

<binding name="netTcpBinding_Secure"
  closeTimeout="00:05:00"
                openTimeout="00:05:00"
  receiveTimeout="00:10:00"
  sendTimeout="00:03:00"
                transactionFlow="false"
  transferMode="Buffered"
  transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard"
  listenBacklog="10"
                maxBufferPoolSize="524288"
  maxBufferSize="65536"
  maxConnections="10"
                maxReceivedMessageSize="65536">

      <reliableSession
              ordered="true"
              inactivityTimeout="00:10:00"
              enabled="false" />

           <security mode="Transport">
             <transport
                clientCredentialType="Windows"
                protectionLevel="EncryptAndSign"/>
              <message clientCredentialType="Windows"/>
             </security>
        </binding>

And time to time also, I di not figured anything yet, I get the same error  saying that communication could not be established because channel  has been aborted...

I have enable tracing on all my services...

But as soon as it I get the error, I am trying to log with the service tarcer tools my log files but could not find teh tracing of the exception... How can you view it ?

If I restart my client application, I cannot reconnect to my service at all. In order to recover I have to kill the w3wp.exe process and restart my client...

I am stuck for weeks in here now trying to figure our but have no more ideas where and how to approach the problem..

My tracing is set as follow on all my services

Code Snippet

....

  <MESSAGELOGGING
     logEntireMessage="true"
   logMalformedMessages="true"
   logMessagesAtServiceLevel="true"
   logMessagesAtTransportLevel="true"
   maxMessagesToLog="3000"
   maxSizeOfMessageToLog="10000"/>






   type="System.Diagnostics.XmlWriterTraceListener"
   initializeData="d:\logs\HistServer.svclog" />



Does my tracing setting is too short in size which will prevent me to see the exception raised ?   

Any help will be really appreiate

Thanks regards

Serge

 

Answer 14

Hi Serge,

           did u resolve the above issue? If yes, plz share how did u resolve?

Thanks,

Naveen

 

Answer 15

Hi,

No I did not solved anything for the moment.. I am still fighting ... In my case and same as all of you my services gets closed as soon as I am a client application which request some data our if the service through Callback..

For my case, if I run my client application and let it run for long time period, it is closed after 2 full days run, or sometimes a single days. For me nothinh to do with time out as gor my test I am calling some service request within my time out settings.

What I was incriminate first what the way I was sending exception message back to my client application using FaultContract. But I have cross check this and it is doen properly and I have even totally desable throwing exception back to my client just to be sure. No help...

Next, I have test to see if it occurs similar if I am using Htt instead of tcp and seems to have no effect.

One thing I am sure is that, if my client application is not running, all my services are running perfectly well full time...

As it is dependant on client application, I might be quite probable that it is linked to this call back chanle or something close to that.

I have also test to catch the Close and Fault event handler, TimeOutException and Communication exception and my surprise was to noticed that when it occurs, known of the handler or exception is catch....

So strange..

What I am suspection now is that, it could come from totally something esle and the error  message is not corresponding at all about the issue.

I will be really glad to find it out after 2 month now that I am fighting with it..  We need to be close and join our effort and test result in order to reach that goal..

I will let you know about my results.

If I am not around and you need to get in touch with me do not hesitate to leave a message on my blog :

http://www.wakespirit.spaces.live.com/

Let's hope...

Serge

 

Answer 16

HI margaret...

Any new infor for all of us in ordert o solve that issue ?

reagrds

serge

 

Answer 17

Serge, you mentioned you were running inside WAS/IIS.

Is there anything that could trigger an appdomain restart in WAS/IIS?

Any app domain restart on the server would cause an open channel  to be aborted. I remember years ago having app domains restart due to a virus scanner running on a IIS server with regular ASP.NET sites.

Also, remember that worker processes are scheduled to recycle at different configurable intervals. These will abort any open channels when being closed out and IIS recreates a new worker process and switches all incoming requests to that. Unless you reinit your call back channel at that time - any calls to it will show as an aborted channel.
 

Answer 18

Hi Jarrod, Thanks for your reply.

How can I find in IIS if anything could trigger an appdomain restart ?

I have MacAfee enterprise runnng on  my test system, should I desable it during my testing ?

I have 5 services running for my applicatiom.There are installed in 3 different Application under IIS.

All of them are accessible through a same tcp port and are using the default pool..

Even if the worker process restart, my client application should be able to catch the Close/Abort event handler right ? but no luck there are not seen at all.

My client application is done according to the WCF guide line, when something goes wrong at server side.

on client I am trapping CommunicationException, timeoutException, other Exception...and in any exception cath, I am aborting the client proxy and recreate it.

hmm I rememeber now, I have test all my services on a console host...Same thing was occuring

As I have mentionned earier and if we want to be logic...when my client application is not running everything works fine for ever.. AS soon as I start my client application then after a while something happen...and the only thing that my client application is using, it is implemnting call back and create proxy client for the request..

I am out of ideas, 2 month mow deep in this

Any other tips ?

Regards

serge

 

Answer 19

Hi again,

From my testing going on I manage to catch from the log files the fact that one of my service gets the Aborted status when the client issu a request..

I can see a warning saying that : "Socket connection aborted"

But now how to analyse all this road path in this log file in order to catch the reason of the Abort ?

Is there a place where I can post the log file ?

Thnaks for help

regards

serge

 

Answer 20

here is the exception that I am able to cathc from my tracing...But then its content its pure cineese for me..

Anyone could help how to dig this out and point me to ideas to check ?

Code Snippet

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">

<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">

<EventID>131075</EventID>

<Type>3</Type>

<SubType Name="Error">0</SubType>

<Level>2</Level>

<TimeCreated SystemTime="2008-04-01T01:51:41.8788020Z" />

<Source Name="System.ServiceModel" />

<Correlation ActivityID="{6e9b9376-a5e0-4a77-87c3-12d3eeeda8c6}" />

<Execution ProcessName="w3wp" ProcessID="5520" ThreadID="55" />

<Channel />

<Computer>VISTATEST</Computer>

</System>

<ApplicationData>

<TraceData>

<DataItem>

<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">

<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>

<Description>Throwing an exception.</Description>

<AppDomain>/LM/W3SVC/1/ROOT/AlarmServer-1-128514400979843750</AppDomain>

<Exception>

<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>

<Message>The socket connection was aborted. This could be caused by an error  processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:03:00'.</Message>

<StackTrace>

at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection&amp; connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper&amp; timeoutHelper)

at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper&amp; timeoutHelper)

at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper&amp; timeoutHelper)

at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)

at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)

at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)

at Maillefer.Nomos.Types.Interface.ISubscriptionService.RaiseTrigger(TriggerType TrigMask, Object[] args)

at Maillefer.Nomos.Types.WcfProxies.Notification.PublisherClient.RaiseTrigger(TriggerType TrigMask, Object[] args)

at Maillefer.Nomos.Plateform.EventSys.SqlClient.Alarm.Insert(Alarm Alarm, String ConnectionString)

at Maillefer.Nomos.Plateform.EventSys.Alarm.Insert(Alarm Alarm)

at SyncInvokeInsert(Object , Object[] , Object[] )

at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)

at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)

at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)

at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)

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.StreamConnection.OnRead(IAsyncResult result)

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

at System.Net.LazyAsyncResult.Complete(IntPtr userToken)

at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)

at System.Net.Security.NegotiateStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

at System.Net.Security.NegotiateStream.ReadCallback(AsyncProtocolRequest asyncRequest)

at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)

at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)

at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)

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

at System.ServiceModel.Channels.ConnectionStream.ReadAsyncResult.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.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:03:00'. ---&gt; System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

--- 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>An existing connection was forcibly closed by the remote host</Message>

<StackTrace>

at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

</StackTrace>

<ExceptionString>System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)</ExceptionString>

<NativeErrorCode>2746</NativeErrorCode>

</InnerException>

</Exception>

</TraceRecord>

</DataItem>

</TraceData>

</ApplicationData>

</E2ETraceEvent>

And here is the following trace info until the Aborted information

Code Snippet

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">

<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">

<EventID>262191</< FONT>EventID>

<Type>3</< FONT>Type>

<SubType Name="Information">0</< FONT>SubType>

<Level>8</< FONT>Level>

<TimeCreated SystemTime="2008-04-01T01:51:41.8788020Z" />

<Source Name="System.ServiceModel" />

<Correlation ActivityID="{6e9b9376-a5e0-4a77-87c3-12d3eeeda8c6}" />

<Execution ProcessName="w3wp" ProcessID="5520" ThreadID="55" />

<Channel />

<Computer>VISTATEST</< FONT>Computer>

</< FONT>System>

<ApplicationData>

<TraceData>

<DataItem>

<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">

<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.FailedAcceptFromPool.aspx</< FONT>TraceIdentifier>

<Description>An attempt to reuse a pooled connection failed. Another attempt will be made with 00:02:59.7968750 remaining in the overall timeout.</< FONT>Description>

<AppDomain>/LM/W3SVC/1/ROOT/AlarmServer-1-128514400979843750</< FONT>AppDomain>

</< FONT>TraceRecord>

</< FONT>DataItem>

</< FONT>TraceData>

</< FONT>ApplicationData>

</< FONT>E2ETraceEvent>

Code Snippet

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">

<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">

<EventID>262170</EventID>

<Type>3</Type>

<SubType Name="Warning">0</SubType>

<Level>4</Level>

<TimeCreated SystemTime="2008-04-01T01:51:41.8788020Z" />

<Source Name="System.ServiceModel" />

<Correlation ActivityID="{6e9b9376-a5e0-4a77-87c3-12d3eeeda8c6}" />

<Execution ProcessName="w3wp" ProcessID="5520" ThreadID="55" />

<Channel />

<Computer>VISTATEST</Computer>

</System>

<ApplicationData>

<TraceData>

<DataItem>

<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">

<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.SocketConnectionAbort.aspx</TraceIdentifier>

<Description>SocketConnection aborted</Description>

<AppDomain>/LM/W3SVC/1/ROOT/AlarmServer-1-128514400979843750</AppDomain>

<Source>System.ServiceModel.Channels.SocketConnection/35898797</Source>

</TraceRecord>

</DataItem>

</TraceData>

</ApplicationData>

</E2ETraceEvent>

Please not that my services are hosted under IIAS / WAS

Thanks for help

regards

serge

 

Answer 21

I just got into the office so I'll take a look a little more in depth during the day when I have time but 2 things...

1) Since you're using Vista to test this on - is there any chance timeouts are occuring because you're hitting the 10 connection limit? I am going to make the assumption that a call back to the client counts as a connection out of the 10 allotted with Vista Ultimate (remember, home/home premium only allow 3). So, connections to IIS/WAS count and the callbacks count even though they are calling across the same physical machine boundary. When things die, how many channels and callback channels are supposedly open?

2) You say the services run fine when your client is not connected. Do you have any other clients accessing the services to determine that they are fine? If calls that are stateless/non-duplex are being made, an AppDomain restart would not have any effect on them (unless the restart happened in the middle of a call). The appdomain would just create a new instance of the service and process the request. With a duplex  channel, the client channel  is held open to make the callback so in a way it is stateful even if you don't have any "session" type shared data you're holding onto. If the appdomain restarts, the callback channel would get closed or aborted.

I have a VPC of vista here, I'll try to force an appdomain restart while tracing so I can view the logs and see if WCF reports a service restart. I can't tell you that it does, a lot of this is based on assumption and I want to give you something more concrete to go on Smile


 

Answer 22

Hi jarod...

Since you're using Vista to test this on - is there any chance timeouts are occuring because you're hitting the 10 connection limit?

No I don't think I have this 10 limit connection as without the client interface, all my services are working correctly and data gets store to Db perfectly well. I have some services which are client of some others..Since this client application is up and runing I get this channel  abort that could happen after 1 days, or 2 days ...totally random..So far I could not get the client running  from Friday to next monday...But then when I check my data in database, all is tehre and corretcly stored.. For for me sounds that tehre is definitly something with those callback and the service which raise callback events

In addition to that, when I need to post a request to the service, I am creating the instance, do the request and then close the instance immediatly.

 here is the process of my application :

I have following service List : Alarm service,Reel service , AlarmHistory Service, ReelHistoryService, NotificationService

Those service are organized as follow under IIS :

Alarmserver Application : Alarm Service,Reel Service

HistServer Application : AlarmHistory Service,ReelHistory Service

NotificationServer Application : NotificationService

All of those IIS Application are using the same default pool and use same tcp port number

The application process is as follow:

One external application call the AlarmService to Insert an Alarm object when it occurs
When the AlarmService has proceed the Insert alarm to database then it create a proxy instance of the NotificationService and call the RaiseTrigger call back as follow :

Code Snippet

InstanceContext m_instanceContext = newInstanceContext(newNotificationCallBack());

WcfProxies.Notification.PublisherClient m_Publisher = newWcfProxies.Notification.PublisherClient(m_instanceContext, "EndPoint_Publisher");

m_Publisher.RaiseTrigger(TriggerType.NewAlarm, newobject[] { Alarm, dsActive });

m_Publisher.Close();

Then as the client as subscribe to that call back Event, when received he will request a refresh of data by calling the AlarmHistory service, which will simply return a new fressh dataset of updated table

 This process repeat each time a new alarm need to be inserted... I can handle more than one alarm at once as I can receive a set of new alarms which might occurs at the same time and all my Services are configured as PerCall

So when it died, I should have the AlarmService and NotificationService available all the time. Those service should never die...They are critical.. may be hosting them under WAS is not a good idea?`

As when I am calling my service request and close the proxy when not needed anymore, I should not have this connection limits right ?

You say the services run fine when your client is not connected. Do you have any other clients accessing the services to determine that they are fine?

What I have noticed is that, if I am running the same client on an other machine at the time the first client died, then it receive correctly information from Services and asnwer correctly.

What I have noticed also is that, after my client died, if I close my client and reopen it then it works again without any trouble...This is why it makes me thinking about those callback stuff...

Now wat is going on exactly on IIS/WAS when such thing occurs I have not the knowledge to explain..The only thing I know is that when a new client connects, the notification service receive a new context object needed for the callback..

If calls that are stateless/non-duplex are being made, an AppDomain restart would not have any effect on them (unless the restart happened in the middle of a call). The appdomain would just create a new instance of the service and process the request. With a duplex  channel, the client channel is held open to make the callback so in a way it is stateful even if you don't have any "session" type shared data you're holding onto. If the appdomain restarts, the callback channel would get closed or aborted.

Is it a behaviour of IIS/Was or behaviour of any host ?

hmmm how to identify this restart then ?

Thanks for your help jarod.

regards

serge

 

Answer 23

Hi jaron,

Some more information based on my test.

I manage to isolate my disconenction trouble and it comes from the fact that the session between my client application and my notification service gets closed for some reason that I do not know yet.

The way I am hadling my notification service is that I am keeping track in a list the callback request and the SessionId which has requested the notification. Then before raising the event to the register client, I am checking if the sessionID issue by the client is still valid. If not it would means that the channel  is not anymore available, like a dead client.

My notification service is defined as follow:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single,

InstanceContextMode = InstanceContextMode.PerSession)]

Then when a client subscribe to the notification service, I am collecting the SessionID follow:

SessionId = OperationContext.Current.SessionId;

Then the sessionID and the subscribed callback event are stored in a Dictionnary list

When the notification service Raise the event, it then send the events to all client context store in the dictionnary list.

If the during the raising event, an exception occurs then it means that context is not anymore valid

SO for some reason, the client context is not anymore valid as when the callback is call to the previous sessionID stored, then nobody is answering..

Any idea how a sessionID can be closed between a client and a service ?

Please not that the client application is still alive, no crash, but simply no more callback event are coming on the previous open callback channel

regards

serge

 

Answer 24

When you turn on tracing - the trace file shows the service host closes on an appdomain recycle - which is as I would have guessed. By default in server 2008's default app pool recycles every 1740 minutes (every 29 hours). Once this happens, your service class instance gets destroyed and garbage collected. Anything in memory at that time is gone, including your call back context, hash table, etc.

If you have tracing turned on, look for service host close events and see if they match up within a few hours of your failures.

Since you're handling call back context in a hashtable, it seems as though you are expecting multiple callback contexts in that instance. That's not going to happen the way you have it set up. The instancing mode and concurrency mode you have selected won't let it. You would need instancing to be Single for the hashtable to really mean anything. You could just use a single variable the way things are now.

Granted, if you get into a single service instance, performance would sink unless you changed to allow a concurrency mode of multiple but then you have to worry about making everything threadsafe and synchronizing access to your context hashtable.

Currently, if your tcp connection closes for whatever reason, the service instance will dispose if the timeouts are reached and your session is lost.
 

Answer 25

Thnaks for your time jarod.

Still some unclear poit for me :

Under IIS I am using the default pool, what is the defult recycle for that pool then ?

Since you're handling call back context in a hashtable, it seems as though you are expecting multiple callback contexts in that instance. That's not going to happen the way you have it set up. The instancing mode and concurrency mode you have selected won't let it. .

Seting InsttanceContext.PerSession is supose to create one service Instance per client session. In that way if I have 2 client running from 2 different PC, accessing my services, then the notification service will receive one session ID for each of them within the OperationContext.Current.Session.id right ?

So then as my service keep track of those context to know where to send back event, it should work becasue one istance will be created per session right ?

You would need instancing to be Single for the hashtable to really mean anything. You could just use a single variable the way things are now

What do you mean ? What the fact of having Single will makes things working if my notification service is recycle ?

Or should I set it to PerCall then ?

Sorry for my stupid question but I simply try to understand why things will not go with my current settings

thnaks for your comemnt

 

Answer 26

If this pool rcycling is the issue, then how to keep the session alive as long as client are connected and would receive callback ?

is there some common seeting for Tcpbinding for such case ?

Actually I am using following seetings for my client and server config :

Code Snippet

<netTcpBinding>

<bindingname="NetTcpBinding"

closeTimeout="00:05:00"

openTimeout="00:05:00"

receiveTimeout="10:00:00"

sendTimeout="00:03:00"

transactionFlow="false"

transferMode="Buffered"

transactionProtocol="OleTransactions"

hostNameComparisonMode="StrongWildcard"

listenBacklog="10"

maxBufferPoolSize="524288"

maxBufferSize="65536"

maxConnections="10"

maxReceivedMessageSize="65536">

<securitymode="Transport">

<transportclientCredentialType="Windows"/>

</security>

</binding>

</netTcpBinding>

Should I add the ReliableSession element ?

regards

 

Answer 27

Serge Calderara wrote:

Thnaks for your time jarod.

Still some unclear poit for me :

Under IIS I am using the default pool, what is the defult recycle for that pool then ?


29 hours or 1740 minutes.

Seting InsttanceContext.PerSession is supose to create one service Instance per client session. In that way if I have 2 client running from 2 different PC, accessing my services, then the notification service will receive one session ID for each of them within the OperationContext.Current.Session.id right ?

So then as my service keep track of those context to know where to send back event, it should work becasue one istance will be created per session right ?


I may have misunderstood what you said earlier. You said you read OperationCotnext.Current.Session.Id and stored it in a hashtable. If that is not correct, disregard. If it is what you do - I was questioning why you were using a hashtable. 1 instance gets created per session. Unless your hashtable is a static member, it will only ever have stored 1 session id. You get a new hashtable with every new instance. Every new session gives you a new service instance. In memory, you will have 2 hashtable instances inside 2 service instances with 2 clients. You could store the session id in a private instance variable. No need for the hashtable with the current configuration. You are treating the service as a singleton if you expect the hashtable to contain the session ids for both clients.


What do you mean ? What the fact of having Single will makes things working if my notification service is recycle ?


Recycle will take place no matter what instance mode you set. Recycling is an IIS configurable property. You can change it to never recycle via the Advanced Settings of the pool in IIS 7 but I am not sure I would advise this. You should probably code to check if the session id exists - and if not, go through the callback registration process again creating a new callback channel.


Or should I set it to PerCall then ?


You can use per call but then you need to change how you are registering your callback channels. They go away with each call so you need to keep them in a static variable and manage them (otherwise they may live as long as the appdomain does even if not in use any more). Which means also that an appdomain reset would destroy any callback references stored in a static variable or not.


Sorry for my stupid question but I simply try to understand why things will not go with my current settings

thnaks for your comemnt



Your questions are not stupid at all. Things can work but there are numerous ways of handling it. If you need service instances to live indefinitely, WAS/IIS may not be the best use.  If you code for the idea that you could lose the callback reference and have a way to handle that situation it will work fine as well.

You could have a custom fault setup for when this happens and when it does, have the client call a Connect() method again which reinits the callback.

If you prefer PerCall, I highly recommend reading the Callback Connection Managemennt section out of "Programming WCF Services"

Now, lets assume PerCall as described in the book with WAS and a recycle event.

1) Client Calls Connect() and registers callback in a static list/hashtable, etc.
2) Service instance disposes as PerCall services do.
3) Client calls method, callback is found within the static hashtable or list and makes callback. Service disposes.
4) Appdomain recycles due to IIS/WAS or a change in the config file. (Yes, changing the config file kills the appdomain)
5) Client calls method, callback is NOT found within the static hashtable and throws fault. Service disposes.
6) Client handles fault, creates new channel  and calls Connect() again to reregister callback...then replays the call that caused the fault. Service disposes.

Repeat...and on app close, you call Disconnect() to remove the callback reference from the static hashtable (sure, IIS worker process recycling will take care of it but its good practice to do it yourself)
 

Answer 28

Thaks for your help.

First of all i forgot to telle you that I am ruing my test on Vista ultimate.

Next when my WinApp client load, it subscribe to my notification service and when it close it usubscribe.

Then my notification service is using a static dictionnary to strore the callback context and the event to register ( coming from client aplication. So if I have 2 client aplpication registering, my dictionnary will have 2 entries with different callback context..

As soon as my ClientApplication gets register to the service, it does nothing else than listening fopr a callback from the notification service.

I have then an OEM aplication which insert data to database, when data gets inserted, the notiofication service Fire to all register context in dictionnary the callback Event "NewDataInserted"..

At this time, all client listening to that callback will catch it....

The what is happening is that if the service gets recycle and context disappeard, client applciation will not receive anything as they have not been notified from a fault service...and the only way to recover is to close clieent application and restart it..

My client application are mainly listners on callback after subscribing...So then how my client can be notify that the notification service that it has to re subscribe ???

What I anm trying to do is that as long as my client are up and runnig they must be able to receive call back even froma  recycling issue...Is tehre any setting or tips to perform this ?

regards

serge

 

Answer 29

Serge Calderara wrote:

Thaks for your help.

First of all i forgot to telle you that I am ruing my test on Vista ultimate.


Next when my WinApp client load, it subscribe to my notification service and when it close it usubscribe.

Then my notification service is using a static dictionnary to strore the callback context and the event to register ( coming from client aplication. So if I have 2 client aplpication registering, my dictionnary will have 2 entries with different callback context..




As soon as my ClientApplication gets register to the service, it does nothing else than listening fopr a callback from the notification service.

I have then an OEM aplication which insert data to database, when data gets inserted, the notiofication service Fire to all register context in dictionnary the callback Event "NewDataInserted"..

At this time, all client listening to that callback will catch it....

The what is happening is that if the service gets recycle and context disappeard, client applciation will not receive anything as they have not been notified from a fault service...and the only way to recover is to close clieent application and restart it..

My client application are mainly listners on callback after subscribing...So then how my client can be notify that the notification service that it has to re subscribe ???

What I anm trying to do is that as long as my client are up and runnig they must be able to receive call back even froma  recycling issue...Is tehre any setting or tips to perform this ?

regards

serge


You could poll *cringe* PerCall is not going to work for you need since the instance to continue to exist indefinitely.



 

Answer 30

HI JArod,,,

Now with your help I understand better the problem with IIS recycling issue and according to what I have noticed during my test and the log, it seems to be that..

Now the problem I have is how to recover from this recycling because I have 2 scenario that might happen:

As mentionned earlier, my client application subscribe to my notification service for call back and notification service keep track of its sessionID and Event in a static dictionnary List

For example  the list will contain for 2 client subscription:

  [0] SessionID=123456, Value="NewData"

  [1] SessionID=987654, Value="NewData"

When new data get inserted, the notification service receive the order to fire the event "NewData". Then it will proceed the following for each dictionary entry :

try

{

    CallBack.NewData  //call back to client

}

catch (Exception)

{

  // callback context is garbage and not existing anymore so remove it from the list

  myList.Remove(myCallBack)

}

Scenario 1: Client1 application has been closed intentionnally and has unsubscribe from the service

=========

 Call back will not reach  Client1 has its context is not anymore belonging to subscribers list. Everything works normally and client2 will receive the call back

Scenario 1:Client1 application is still running and is still register to notification service but recycling has occured

=========

 At that time the notification service is firing call back to its list of subscribers, but client1 context generate an exception because it has been aborted for some reason. Recycling issue.

From that point has for the notification service this is an unknown valid chanel, it removes it from the list. But the client1 application is still alive and ahs not called the Unsubscribe function.. Then the client1 application has no idea that the notification channel  has been aborted..

An other point is that the client1 has an eventhandler to the notification service Close and Fault event, but those event are not fired and not catch by the client....

How my client can be notify about its garbage call back channel in order than it can Subscribe again ?

thnaks for tips any idea ?

regards

Serge

 

Answer 31

Well, it would be quite a bit of work but the only two real options I can think of are the following:

1) Move to a windows service where you can control the appdomain explicitly without having to worry about IIS/WAS doing it for you.

2) Have you looked at the WCF 3.5 samples? There is a durable service sample there. I'm not saying implement it exactly but if you could serialize and recreate the callback contexts on service close/open you'd be fine. Although the sample is not simple. It goes into creating your own method invokers, intance provider, etc.


 

Answer 32

Thanks for your reply jarod..

No I did not check the WCF 3.5 sample yet becasue I m still running under 3.0 and I do not want to mixed framewrok now otherwise I would not have catch was as really created my troubles...

As soon as I will find an issue and 100% sur that my aborte comes from recycling then I will move to 3,5..

As a solution the easiest for me would be to move only the notification service as a windows Service but then I will not be able to use TCP and that was the reason of using WAS, and if I use http then I would have to use WsDualHttp binding cause of my call back and I was a bit afraid of speed to process notidfication request...

Then I have though as an other solution.. as mentionned previously if my client close normaly I should not have its context in the list anymore as it has Unsusbribe. but then if exception gets catch during a callbck, then it means that the channel  is garbage, so it is remove from the list and do not care about client as connection is dead..

But what I was thinking of is that after removing the callback from the list I could raise a FaultException like "Invalide channel" which client can catch...

Then if client is alive, it will receive that exception and then I will repeat the Subscription again ...

Sounds working no ? what do you think

regards

serge

 

Answer 33

You can use TCP in a windows service. If you're worried about the ports, use the port sharing service.

On another topic of the callback channels. Actually if everything has recycled you will not have anything in your list. The list will be empty. No need to remove it from the list. The appdomain has been reset and that list is newly initialized. There is nothing to remove. Also, what client would catch the invalid channel  fault? You don't have a callback reference to send the fault across.



 

Answer 34

hmmm , yes your are right.. stupid am I.. the channele is definetly deead so even exception will not go...

What do you meand by using TCP sharing service ???

Based on th disctionnary list, then I have no ther way to handle it as a permanent registrtaion process by storing context in database... Then in case of recycling I can check in database fro suscriber to rebuild...

regard

serge

 

Answer 35

Hi Jarrod,

You know what, I am runing a test for 3 full days now with my notification service issue and my callback channel  wich was recycling due to IIS.

The only thing I change from my test is that I change for my Notification Service the InstanceContext mode.

Actually I set it to be PerCall and surprisingly my call back channel is still alive for 3 full days run... 

How can you explain that it was failling with PerSession and working ok so far with PerCall ?

Once again I simply try to understand what is going on and having a clear view

regards

serge

 

Answer 36

hi jarrod,,

Forget my last post, I have found why everything is running fine...I have just desable the recycling for testing and now I ma sure it comes from this....

Thanks so much for your help..Might have hard time to find out this recycling issue as I did not know how IIS was working with it... Now to remember it I will post it on my blog to remember... Thansk do much

regards

serge

 

Answer 37

hi, i think, it's very difficult to avoid IIS restarting.

and, even more, i found that the exception will be thrown inside Reference.vb file, which we are told that not commended to change.

      Public Function BeginTalk(ByVal UserType As Integer, ByVal UserUID As Long, ByVal Room As Long, ByVal Text As String, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult Implements ServiceDuplex1.IDuplexService.BeginTalk
        Dim _args((4) - 1) As Object
        _args(0) = UserType
        _args(1) = UserUID
        _args(2) = Room
        _args(3) = Text
        Dim _result As System.IAsyncResult = MyBase.BeginInvoke("Talk", _args, callback, asyncState) <<<<----- here thrown.
        Return _result
      End Function

 and if i put a try....catch here, next time i update the wcf  reference, the code here will be auto-generated again, and the code written by me will be overwitten. very difficult to maintain.

and if i put a try out of the BeginTalk function, like this.

  Private Sub TalkAsync(ByVal Message As String)
    If Client IsNot Nothing AndAlso Client.ChannelFactory.State = CommunicationState.Opened Then
      Try
        Client.TalkAsync(ChatUserType, ChatUserUID, ChatRoom, Message) <<<<<<------------ here
      Catch ex As Exception

i found it couldn't catch the exception inside the BeginTalk of TalkAsync with this Try Catch.
so, we can't give the user a friendly interface when we restart the IIS but to throw a exception.

i hope that we can find out a good way to put the try catch to let the client catch the IIS restart, so that to tell the user, "sorry, we are not restarting the server... pls wait a minute." :D

can you help me with this question? thank you!!!

 

Answer 38

It could be due to the messsage size. Did you try increasing the size. The maximum is as follows:

maxBufferPoolSize="2147483647"

 

maxBufferSize="2147483647"

maxReceivedMessageSize="2147483647">

 

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter