Reputation: 125
I have been working on this issue for a few days now and can't seem to find a solution :(
I have an Asynchronous call to a WCF service which will work sometimes and on other occassions will do absolutely nothing - no call, no error, nothing. It will just stop after the execution of my calling method (main thread). Breakpoints have been added to both the service method and in the auto-generated proxy class. If I am debugging on a failed call, these breakpoints will never be hit. Other times (when it happens to work) all break points will be hit.
I have completely removed the service and added it again, but still no luck. I have even added a new service method and request message object in the hope that it was a freak problem with the original, however I am experiencing the same issue with the newly inserted method as well.
Just to note - This issue happens more often when I publish my application to a Virtual Machine. It doesn't happen so much on my local machine, however it still happens.
Here is an example of my code:-
This is the async call to the service;
ValidateUpdatesMessageRequest request = new ValidateUpdatesMessageRequest();
_serviceClient.ProcessUpdatesAsync(Request)
The service method looks like this;
public ValidateUpdatesMessageResponse ProcessUpdates(ValidateUpdatesMessageRequest request){
//method body
}
I also have an interface for the service which looks like this;
[OperationContract]
ValidateUpdatesMessageResponse ProcessUpdates(ValidateUpdatesMessageRequest request);
I would appreaciate ANY feedback whatsoever that may help steer me in the direction of a solution.
If you require any further info, please just let me know.
Many thanks in advance!
Upvotes: 4
Views: 2198
Reputation: 151
Had a similar issue. In my case the reason for that was too low maxArrayLength value in readerQuotas of the binding.
Upvotes: 0
Reputation: 125
I have actually now resolved my issue.
I thought I would post my solution for anyone else who might be experiencing the same problem.
At the end of my method which calls the async method:-
_serviceClient.ProcessUpdatesAsync(request);
I had a
CleanUp()
which made a call to
_serviceClient.CloseAsync();
So this was being closed before the service method could be run.
I simply took the
CleanUp()
out of the orginial method call to the service and placed it in the event completed method, this way the async thread is closed on completion. Seems so obvious now!
Thank you for all of your suggestions and input, it is much appreciated!
Upvotes: 1
Reputation: 65391
There are 3 basic reasons for this happening:
Hope this helps.
Upvotes: 1