none
using wsHttpBinding with reliableSession when the transaction takes longer than 30 seconds RRS feed

  • Question

  • I have a simple service that will return a List<Customers> (eventually). At the moment it only contains a Thread.Sleep(30000) in an effort to try to pin down the problem (so its not due to messagesize).

    I get the exception "The underlying secure session has faulted before the reliable session fully completed" and when checking the stacktrace

    Server stack trace: 
       at System.ServiceModel.Channels.ReliableRequestSessionChannel.SyncRequest.WaitForReply(TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    So I think it has somthing to do with the timeout in WaitForReply(TimeSpan timeout)... but I'm unable to alter this timeout via the web.config file or on the clientside. Is it even possible to do? No matter what, it returns an exception after aprox 20 seconds.

    If I alter to Thread.Sleep(15000)  everthing works fine... or if I set reliableSession enabled="false" it also works great.

    My own theory at the moment is that it has an active connection but if it doesn't get a respons at all within 20 seconds from the channel (not even an exception) it simply timesout no matter what. Is Reliablesessions designed to handle lenghty calls?

    Anyone who can reproduce this? Is it something else i'm missing or it this simply how it's supposed to work? Some problem with my Visual Studio installation?

    I have done all my testing locally trying to understand how it works. The service is published via Azure emulator and the client get its service reference from there.

    I guess the question boils down to if it's doable at all? Should I keep trying to get it to work or simply redesign my solution... For example lift out the messages that does not return within a couple of seconds and place those messages in another service not using reliablesession and let the rest of the messages stay put in its current service and benefit from the reliablesession for those


    • Edited by Vultens Thursday, February 4, 2016 9:17 AM
    Wednesday, February 3, 2016 3:05 PM

Answers

All replies

  • Do you have any sample?
    • Marked as answer by Vultens Sunday, February 7, 2016 7:33 PM
    Friday, February 5, 2016 2:56 PM
  • Thank you for asking for a sample… that did the trick! Since I couldn't use my code as an example (it’s in production and quite large) I decided to make you a short and concise example showing the error. When I did, I couldn’t replicate the error… so it works… a reliable session can handle long running calls… good news and bad at the same time… why didn’t it work in my other project. So I compared and experimented… and just now I found what was wrong.

    Upon publishing the project onto Azure I used the setting “Instance count: 2” inside the webrole and this is why the reliablesession fails. Apparently the “Instance count” for the webrole can only be 1 in Azure otherwise reliablesession gets very confused and I get the error described above. At least this is what I decided to believe after several days of frustration. Time will tell if this is a valid assumption. For now it works and that’s good enough. I can live with "Instance count: 1"

    Anyhow I will mark this as answered since you helped me by asking for a sample, and I have a test project if you want to try it for yourself… but where do I put it? This is my first ever question in this forum and I don’t see anywhere to post a zipped file.

    Sunday, February 7, 2016 7:33 PM