In our application, some of our REST-style WCF calls are failing. These calls are part of a C# class of service implementations that have many other peer service calls that work. Also, the service calls for the failing methods do not fail in all circumstances.
Basically, the situation I'm seeing is that when watching an XHR service call in FireBug, the request is sent. Then, after about 1 second, the browser says a response of 404 Not Found or perhaps something in the 500 series - different by situation.
If I place a break point in the server code, the service call reaches the user-code and the entire correct result is produced by that code. However, the browser still returns these error codes. AND, it doesn't wait until the user-code is finished processing - it still takes about 1 second, not a timeout issue.
A WCF trace doesn't provide any answers (to me) but it does give another clue. A System.InvalidOperationException Error condition with the message, "A reply has already been sent from this RequestContext." I don't think I could send two responses to the same re开发者_开发知识库quest in WCF if I tried.
I don't expect that someone will be able to diagnose my WCF issue exactly with this incomplete picture of the scenario, but perhaps someone can explain the mechanisms at work that would allow a service call to be made, the request to be received and routed, a correct response to be generated, while an error message is returned from WCF separately (and possibly ahead of the normal response).
I have seen the same problem in a slightly different context.
What happens is:
- The http request comes into the server
- The server starts to respond
- The part that gets sent out first is the http header
- When the header has already been sent to the client some code tries to write to the header
- Since the header is already out of the door... BOOM
That also explains why you are getting the error before the server processing is complete.
Check your code for anything that could set a value in the http header.
精彩评论