我认为在尝试返回复杂对象(具有嵌套对象的嵌套对象的对象)时,我有序列化或大小调整问题。
错误代码我得到一个CommunicationException。有什么想法吗?
编辑:这是堆栈跟踪
A first chance exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll
System.ServiceModel.CommunicationException: Connessione sottostante chiusa: Chiusura imprevista della connessione.. ---> System.Net.WebException: Connessione sottostante chiusa: Chiusura imprevista della connessione..
in System.Net.HttpWebRequest.GetResponse()
in System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- Fine dell'analisi dello stack dell'eccezione interna ---
Server stack trace:
in System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
in System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
in System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
in System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
in System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
in System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout)
in System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
in System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
in System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
in System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
in System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(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.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
in RecuperoPagati.DataCoreReference.IDataCoreService.GetDossierByNumDossier(String Env, String NumDossier)
in RecuperoPagati.DataCoreReference.DataCoreServiceClient.GetDossierByNumDossier(String Env, String NumDossier) in C:\Documents and Settings\gdipietro\Documenti\Dev\Rifatturazione\RecuperoPagati\RecuperoPagati\RecuperoPagati\Service References\DataCoreReference\Reference.vb:riga 198
in RecuperoPagati.WebUserControl1.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\gdipietro\Documenti\Dev\Rifatturazione\RecuperoPagati\RecuperoPagati\RecuperoPagati\WebUserControl1.ascx.vb:riga 8
答案 0 :(得分:1)
我同意约翰;它可能不是类型复杂性问题。要冒出真正的罪魁祸首,您可以尝试将诊断日志记录添加到服务配置中。 WCF的跟踪和日志记录功能非常强大,可以帮助您找到大多数问题的根本原因。
如果您正在运行VS2008,则在右键单击服务主机项目的配置文件时,应该会看到“编辑WCF配置”的菜单选项。选择“诊断”节点以启用跟踪和消息记录。
http://msdn.microsoft.com/en-us/library/ms730064.aspx
可以在服务跟踪查看器工具中非常有效地查看此日志的输出,该工具应该已经在您的计算机上(随框架提供)。
答案 1 :(得分:0)
问题可能与类型的复杂性无关。请发布包含所有InnerException的完整异常。只需捕获异常并发布ex.ToString()。