none
HRESULT 0x80070016 WCF service RRS feed

  • Question

  • Hello!

    I got that error on WCF service hosted on IIS 7.5 as web service (configured with multiple instances, requests per call and 1 process). I found that this error throws HttpSendResponseEntityBody when duplicated requestId is detected, but this is a http server level on iis and  .net wrappers just throws up COMException to CommunicationException. I know this is not drivers fault, I dont use Kinect libs, service port binded only to this service, server doesnt communicate with RS. After this error server hangs and dont response amount of time, what is not acceptabe.

    Perhaps, this is the bug in http_core\.net\wcf_configs\apppool\maxthreads\maxprocesses\sync-async_requests and more and more. Perhaps I wrong... I don't know where else I should search and how can I solve this.

    Could someone help me with this problem and explain why this error happens?

    Here is the stack

    Error System.ServiceModel.CommunicationException: The remote host closed the connection. The error code is 0x80070016. ---> System.Web.HttpException: The remote host closed the connection. The error code is 0x80070016.
       at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
       at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
       at System.Web.HttpResponse.Flush(Boolean finalFlush)
       at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
       at System.ServiceModel.Channels.BytesReadPositionStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.ServiceModel.Activation.HostedHttpContext.HostedRequestHttpOutput.HostedResponseOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       --- End of inner exception stack trace ---
       at System.ServiceModel.Activation.HostedHttpContext.HostedRequestHttpOutput.HostedResponseOutputStream.CheckWrapThrow(Exception e)
       at System.ServiceModel.Activation.HostedHttpContext.HostedRequestHttpOutput.HostedResponseOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count)
       at System.Xml.XmlStreamNodeWriter.FlushBuffer()
       at System.Xml.XmlStreamNodeWriter.GetBuffer(Int32 count, Int32& offset)
       at System.Xml.XmlUTF8NodeWriter.WriteBase64Text(Byte[] buffer, Int32 offset, Int32 count)
       at System.Xml.XmlBaseWriter.WriteBase64(Byte[] buffer, Int32 offset, Int32 count)
       at System.Xml.XmlDictionaryWriter.WriteValue(IStreamProvider value)
       at System.ServiceModel.Dispatcher.StreamFormatter.Serialize(XmlDictionaryWriter writer, Object[] parameters, Object returnValue)
       at System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Stream stream)
       at System.ServiceModel.Channels.HttpOutput.WriteStreamedMessage(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpRequestContext.OnReply(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.RequestContextBase.Reply(Message message, TimeSpan timeout)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.Reply(MessageRpc& rpc) 

    Tracing is enabled on service and shows only the following warnings

    RequestContext aborted source System.ServiceModel.Activation.HostedHttpContext

    and next

    Failed to send response message over HTTP source System.ServiceModel.Dispatcher.OperationFormatter+OperationFormatterMessage

    Thanks and regards,

    aerinea


    • Edited by aerinea Friday, January 25, 2013 6:41 AM
    Friday, January 25, 2013 6:39 AM

All replies

  • Hi,

    After research, you may try removing the Response.Flush() for your service to avoid the exception. Check a post here.

    http://www.shubho.net/2010/08/systemwebhttpexception-remote-host.html

    Hope it helps.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Haixia_XieModerator Monday, February 4, 2013 3:03 AM
    • Unmarked as answer by aerinea Monday, March 25, 2013 4:49 AM
    Wednesday, January 30, 2013 3:14 AM
    Moderator
  • Thanks for reply, but I have some more questions.

    remove the Response.Flush()... sounds like a hack. But how can I do this if service doesn't have asp pages and web "logic" and doesn't use buffered messages? 

    btw, I still cannot understand why I get error "device doesn't recognize command" on web hosted wcf service... and what's that "device"? 

    Tuesday, February 5, 2013 2:46 AM
  • Hi,

    Can you explain thes issue more clearly?

    How do you get this error "device doesn't recognize command"?

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 5, 2013 9:27 AM
    Moderator
  • Sorry for late answer...

    Well, lets try to explain. I found hresult 0x16 in win32 error code list what is equals code 22. This code is ERROR_BAD_COMMAND (errors) and returns by HttpSendResponseEntityBody function. Service works asynchronous with multithreads and multicalls on 1 app pool. 

    I thought that this is the fault of app pool, because all ports were busy. But i wrote load test app that sends async requests and waits for heavy answer (file stream for example) in parallel and gets all available for IIS ports, and found that no 0x16 error occurs. Any ideas? 

    Tuesday, March 12, 2013 3:50 AM
  • so, no one knows?...
    Thursday, July 4, 2013 3:00 AM