服务器未提供有意义的回复;这可能是由协定不匹配、会话过早关闭或内部服务器错误引起的。

gaomeng320 2012-04-23 11:01:18
是发送文件的时候报的错
我感觉应该是集合的size太大了
所以我在服务端的behavior里加了一句
<dataContractSerializer maxItemsInObjectGraph="6553600"/>

因为发送小文件的时候没问题,超过20kb就有这个问题
可是我这么设了还是不行,请教

以下是我的错误信息

用户代码未处理 System.ServiceModel.CommunicationException
Message=服务器未提供有意义的回复;这可能是由协定不匹配、会话过早关闭或内部服务器错误引起的。
StackTrace:
位于 System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
位于 System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
位于 System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
位于 SLA_Fax.FaxServiceProxy.FaxServiceClient.FaxServiceClientChannel.EndSendFax(CustomException& status, IAsyncResult result)
位于 SLA_Fax.FaxServiceProxy.FaxServiceClient.SLA_Fax.FaxServiceProxy.IFaxService.EndSendFax(CustomException& status, IAsyncResult result)
位于 SLA_Fax.FaxServiceProxy.FaxServiceClient.OnEndSendFax(IAsyncResult result)
位于 System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException:

...全文
825 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
E次奥 2014-03-31
  • 打赏
  • 举报
回复
十分感谢啊,帮我大忙了!
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]

引用 2 楼 的回复:

<bindings>
<basicHttpBinding >
<binding name="ServiceSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"
closeTimeout="00:10:00……


对 不是……
[/Quote]

你用的是wcf吧,我上面的是用的webservice的
gaomeng320 2012-04-23
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]

<bindings>
<basicHttpBinding >
<binding name="ServiceSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"
closeTimeout="00:10:00……
[/Quote]

对 不是http的 是netTcpBinding的
  • 打赏
  • 举报
回复
<bindings>
<basicHttpBinding >
<binding name="ServiceSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"
closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:30:00" sendTimeout="00:10:00"
>
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>

加到配置文件里试试
gaomeng320 2012-04-23
  • 打赏
  • 举报
回复
我又加了一句这个,现在200K以上的还是不行

<readerQuotas maxDepth="32" maxStringContentLength="888192" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />


这些长度都是以什么为单位的?
我传byte数组的话要看的是不是maxArrayLength这个?
gaomeng320 2012-04-23
  • 打赏
  • 举报
回复
解决了 记录一下

//服务端
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="CustomNetTcpBinding" maxReceivedMessageSize="2147483647">
<security mode="None" />
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="False"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

//客户端
<bindings>
<customBinding>
<binding name="NetTcpBinding_IFaxService">
<binaryMessageEncoding />
<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
gaomeng320 2012-04-23
  • 打赏
  • 举报
回复
按理说已经能上传50kb以下的文件就说明配置起作用了
可我这些配置都应该是最大值吧 为什么50kb以上的还是不行呢
WCF传输List时序列化问题 今天使用WCF传输用户集合时出现了一个诡异的错误:System.ServiceModel.CommunicationException: 服务器提供意义回复;这可能是由协定不匹配会话过早关闭内部服务器错误引起的。  百思不得其解,在数次尝试后,发现应该不会是协定不匹配或者会话关闭,于是尝试将传输的List&lt;User&gt;变小,当List&lt;User&gt;变的很小时变不再出现...

8,737

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧