-1

我在收到此错误之前所做的修改。我在所有课程中都已更改byte[]为。Stream

System.ServiceModel.CommunicationException: The underlying connection was closed: The connection was closed unexpectedly. ---> System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.    
   at System.Net.HttpWebRequest.GetResponse()    
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

   --- End of inner exception stack trace ---       

Server stack trace:     
   at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)    
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)    
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)    
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)    
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)    
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)    
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)    
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)


Exception rethrown at [0]:     
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)    
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)    
   at MyWCFServiceTest.MyWCFService.ICommonService.UploadDocument(UploadDocumentRequest request)    
   at MyWCFServiceTest.MyWCFService.MyServiceClient.MyWCFServiceTest.MyWCFService.ICommonService.UploadDocument(UploadDocumentRequest request) in C:\Users\KishoreJangid\Desktop\ChangeSAPTransactionStatus\MyWCFServiceTest - Copy\MyWCFServiceTest\Service References\MyWCFService\Reference.cs:line 2376    
   at MyWCFServiceTest.MyWCFService.MyServiceClient.UploadDocument(RequestHeader UploadDocumentReqHdr, Byte[]& UploadDocumentContent) in C:\Users\KishoreJangid\Desktop\ChangeSAPTransactionStatus\MyWCFServiceTest - Copy\MyWCFServiceTest\Service References\MyWCFService\Reference.cs:line 2383    
   at MyWCFService.Form1.DocumentUpload_Click(Object sender, EventArgs e) in C:\Users\KishoreJangid\Desktop\ChangeSAPTransactionStatus\MyWCFServiceTest - Copy\MyWCFServiceTest\Form1.cs:line 88
4

2 回答 2

1

由于缺乏对您要达到的目标的解释,您是否已更新所有消费者以使用新类?我想你已经改变了数据合同和这个破碎的消费者。

如果不是,我会查看您传输了多少数据,请参阅此博客文章!似乎这就是问题所在。

我遇到了一些问题,可能是配置问题,或者如果您在 IIS 中托管,则存在有关权限的问题,请尽可能详细说明。

于 2012-08-10T13:12:24.130 回答
0

如果您期望从调用的方法返回并使用 WCF 服务,则此错误背后的一个可能原因可能是您的对象序列化/反序列化问题。如果您的服务方法返回不可序列化的内容,那么您的代理通道会出现此错误。

为避免这种情况,只需检查-

  1. 返回类型并确保它是可序列化的。您可能必须将 [Serializable] 属性与您的类一起放置。
  2. Have [DataMember(IsRequired=true)],它告诉值将在序列化时出现(它说下划线属性是不可为空的值类型)。
  3. 确保您的枚举值与存储在表中的值匹配。这是非常危急的情况,因为您没有预料到。
于 2013-03-15T11:54:09.687 回答