Solved

Error with WCF on client after 10 minutes

Posted on 2013-01-12
13
1,682 Views
Last Modified: 2013-04-09
I am having an issue with WCF in .Net 4.5

My client application throws and error after 10 minutes.  I have researched the web and have extended every timeout I could fine – with no luck.
My console application is designed to run on a local network.  It performs calculations in excel sheets that can take hours to complete – therefore erroring after 10 minutes is not good.

To troubleshoot I have created a test host that uses the Sleep method for 10 minutes, it crashes each time.  I am not sure how useful the content of the error is since it seems to be rather generic.  Before I have my client call the host, I confirm the different timeout settings.  Below is what the client shows:

CloseTimeout Hours: 23
CloseTimeout Minutes: 59
CloseTimeout Seconds: 59
OpenTimeout Hours: 23
OpenTimeout Minutes: 59
OpenTimeout Seconds: 59
ReceiveTimeout Hours: 23
ReceiveTimeout Minutes: 59
ReceiveTimeout Seconds: 59
SendTimeout Hours: 23
SendTimeout Minutes: 59
SendTimeout Seconds: 59

I have included the error from the client below, I am not sure how helpful this is.  Also, the host application does not thrown an error message.  

ERROR: An error occurred while receiving the HTTP response to http://localhost:8
000/DistributorService/DistributorService. This could be due to the service endp
oint binding not using the HTTP protocol. This could also be due to an HTTP requ
est context being aborted by the server (possibly due to the service shutting do
wn). See server logs for more details.

Unhandled Exception: System.ServiceModel.Security.MessageSecurityException: An u
nsecured or incorrectly secured fault was received from the other party. See the
 inner FaultException for the fault code and detail. ---> System.ServiceModel.Fa
ultException: The message could not be processed. This is most likely because th
e action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT/Cancel' is incorre
ct or because the message contains an invalid or expired security context token
or because there is a mismatch between bindings. The security context token woul
d be invalid if the service aborted the channel due to inactivity. To prevent th
e service from aborting idle sessions prematurely increase the Receive timeout o
n the service endpoint's binding.
   --- End of inner exception stack trace ---

Server stack trace:
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurit
ySessionChannel.ProcessRequestContext(RequestContext requestContext, TimeSpan ti
meout, SecurityProtocolCorrelationState correlationState)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurit
ySessionChannel.ReceiveInternal(TimeSpan timeout, SecurityProtocolCorrelationSta
te correlationState)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityReque
stSessionChannel.CloseOutputSession(TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurit
ySessionChannel.CloseSession(TimeSpan timeout, Boolean& wasAborted)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurit
ySessionChannel.OnClose(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnClose(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
   at System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
   at System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.
Close(TimeSpan timeout)
   at System.ServiceModel.ClientBase`1.Close()
   at redactExcelDistributed.Program.Main(String[] args) in d:\_dev\Distributor\
redactExcelDistributed\redactExcelDistributed\redactExcelDistributed.cs:line 219
0
Comment
Question by:rye004
[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
  • 7
  • 3
13 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 38771321
the problem is might be the time difference between client and server.
the "remote" server and the client machine should be 10 minutes time of each other.
If that is not the case, a validation will trigger this exception.
make sure the clock on the Server hosting client application is not out of sync with the server having the service.
0
 

Author Comment

by:rye004
ID: 38773141
Thank you for replying to my posting.  I did confirm that all my system clocks are synced using the same time.

I also ran the Client and Host on a single machine and still got the same issue.
0
 

Author Comment

by:rye004
ID: 38779067
Thank you for your help.
0
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 18

Expert Comment

by:dj_alik
ID: 38779356
please perform some checks:

Check timezones: client and servers
may be a service reference/proxy out of date, even with the server & client on the same machine. try to run 'Update Service Reference' for proxy refresh.
Trace your server side.:http://msdn.microsoft.com/en-us/library/ms733025.aspx
Modify Clockskew value  in app.config of client
changed wshttpbinding protocol from "https" to "http"
MessageSecurityException is a generic kind of exception and can be thrown for many problems. To know the real exception we added a serviceDebug behavior to service config and watch the eventviewer for detailed info about the error.
This is the debug config:
<serviceBehaviors>
<behavior name="ServiceBehavior">
 <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
 <serviceDebug includeExceptionDetailInFaults="true" />
 <serviceSecurityAudit auditLogLocation="Application"
  suppressAuditFailure="false"
  serviceAuthorizationAuditLevel="None"
  messageAuthenticationAuditLevel="SuccessOrFailure" />
</behavior>

Open in new window

Check if the Application Pool  have permissions to write at "C:\Windows\Temp"
0
 

Author Comment

by:rye004
ID: 38779912
Thank you for taking the time to send me this information.  I am going through what you listed above.  I will let you know what I find.
0
 
LVL 18

Expert Comment

by:dj_alik
ID: 38781422
OK
This my checklist.
I gathered for you all methods that may help to solve or find the problem..
0
 

Author Comment

by:rye004
ID: 38784202
I am still working on your check list.  I did find the following error in a trace log from the client.  I am currently researching this to see how to get around this.  Any input would be greatly appreciated.

An error occurred while receiving the HTTP response to http://localhost:8000/DistributorService/DistributorService. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
0
 
LVL 18

Expert Comment

by:dj_alik
ID: 38785876
please get the details...
and please trace the server side.
0
 

Accepted Solution

by:
rye004 earned 0 total points
ID: 38862363
Thank you everyone for your help. Unfortunately I have given up on WCF and switched back to remoting. WCF was not with the effort, sorry.
0
 

Author Comment

by:rye004
ID: 39048292
Sometimes you need to go with what works.  There is a lot less issues with using Remoting over WCF.
0
 

Author Closing Comment

by:rye004
ID: 39061183
Sometimes you need to go with what works.  There is a lot less issues with using Remoting over WCF.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

726 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