Solved

Error with WCF on client after 10 minutes

Posted on 2013-01-12
13
1,585 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
  • 7
  • 3
13 Comments
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you for your help.
0
 
LVL 18

Expert Comment

by:dj_alik
Comment Utility
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
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 18

Expert Comment

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

Author Comment

by:rye004
Comment Utility
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
Comment Utility
please get the details...
and please trace the server side.
0
 

Accepted Solution

by:
rye004 earned 0 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Sometimes you need to go with what works.  There is a lot less issues with using Remoting over WCF.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now