An error occurred while WCF received the HTTP response from my service

Source: Internet
Author: User
Tags stack trace

Error content:

System.ServiceModel.CommunicationException: Receive to https://An error occurred while xx.com/xx.svc the HTTP response. This may be due to the fact that the service endpoint bindings are not using the HTTP protocol.
This may also be caused by the server aborting the HTTP request context (possibly due to a service shutdown). For more information, see Server logs.
---> System.Net.WebException: The underlying connection has been closed: An error occurred while receiving.
---> System.IO.IOException: Unable to read data from the transport connection: the remote host forced the shutdown of an existing connection.
---> System.Net.Sockets.SocketException: The remote host forced the shutdown of an existing connection. in System.Net.Sockets.Socket.EndReceive (IAsyncResult asyncResult) in System.Net.Sockets.NetworkStream.EndRead ( IAsyncResult AsyncResult)---the end of the inner exception stack trace---in System.net.security._sslstream.endread (IAsyncResult asyncResult) in System.Net.TlsStream.EndRead (IAsyncResult AsyncResult) at System.Net.PooledStream.EndRead (IAsyncResult asyncResult) in System.Net.Connection.ReadCallback ( IAsyncResult AsyncResult)---the end of the inner exception stack trace---in System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) in System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse ( IAsyncResult result)---the end of the inner exception stack trace---Server Stack trace: in System.runtime.asyncresult.end[tasyncresult] (IAsyncResult result) in System.ServiceModel.Cha Nnels. ServiceChannel.SendAsyncResult.End (sendasyncresult result) in System.ServiceModel.Channels.ServiceChannel.EndCall ( String action, object[] outs, IAsyncResult result) in System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService (IMethodCallMessage Methodcall, Proxyoperationruntime operation) in System.ServiceModel.Channels.ServiceChannelProxy.Invoke (IMessage message) Exception Rethrown at [0]: In System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqmsg, IMessage retmsg) in System.run Time. Remoting.Proxies.RealProxy.PrivateInvoke (MessageData&msgdata, Int32 type) in Sinopec.UC.Client.Groups.ChatGroupSev.IChatGroupPersistence.EndGetGroupListByMember ( IAsyncResult result) in Sinopec.UC.Client.Groups.ChatGroupSev.ChatGroupPersistenceClient.OnEndGetGroupListByMember (IAsyncResult result) in System.ServiceModel.ClientBase '1. onasynccallcompleted (IAsyncResult result)

Workaround 1:

There are many scenarios when this type of error occurs.

First check that you provide appropriate [DataContract] and [DataMember] whether this does not provide and then this type of error occurs. You must write the [DataContract] above class, you pass the response, and write to [DataMember] above the class member, which is to go to the client response.

[DataContract] class program{  [DataMember]   publicstring exampl{get;  Set}}

Workaround 2:

Verbose Listener Client request process

If some of the MinValue data types are passed, check the response. This means that some time the data member is not initialized, the time it takes it Minvalue. eg MinValue int is '-2147483648 ', so a period of time cannot be serialized and an error is raised.

If you have a trace of this type of error, then write down the code in your server-side Web. config below

<System.Diagnostics><sources>  <Sourcename= "System.ServiceModel"Switchvalue= "information, activitytracing"propagateactivity= "true">    <Listeners>      <Addname= "TraceListener"type= "System.Diagnostics.XmlWriterTraceListener"initializedata= "D:\Traces.svclog"/>    </Listeners>  </Source></sources>

Show Results:

Service-side exception, detail message:

An error occurred while trying to serialize the parameter http://tempuri.org/: Getmodelresult.
The innerexception message is "The Data contract name is" ABOVEUSER_CD87D9757642C65F2A0EC43C3809842CB7DC067138FCEBB7FD761F5193DFA9B9:
http://schemas.datacontract.org/2004/07/System.Data.Entity.DynamicProxies "type of
"System.Data.Entity.DynamicProxies.AboveUser_CD87D9757642C65F2A0EC43C3809842CB7DC067138FCEBB7FD761F5193DFA9B9" is not the desired type. Consider using Datacontractresolver (if you are using DataContractSerializer), or statically add any unknown type to the list of known types. For example, you can use the KnownTypeAttribute property or add an unknown type to the list of known types that are passed to the serializer. ”。 For more information, see innerexception.

An error occurred while WCF received the HTTP response from my service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.