积极答复者
处理图片上传出现了两个问题,求解答

问题
-
我在做图片上传的时候出现了如下问题
1、首先我图片是在数据库字段里面,并采用DataSet上传,但直接被服务器拒绝了,错误信息如下:
套接字连接已中止。这可能是由于处理消息时出错或远程主机超过接收超时或者潜在的网络资源问题导致的。本地套接字超时是“00:09:59.9940000”。
如果将时间加长也是如此
2、然后我又采用Byte[]单独上传图片,又出现了以下的错误信息:
格式化程序尝试对消息反序列化时引发异常: 尝试对参数 http://tempuri.org/ 进行反序列化时出错: streamByte。InnerException 消息是“反序列化对象 属于类型 System.Byte[] 时出现错误。读取 XML 数据时,超出最大数组长度配额(16384)。通过更改在创建 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxArrayLength 属性,可增加此配额。”。有关详细信息,请参阅 InnerException。
以上两个问题都是采用同样的配置信息
服务端:
<netTcpBinding>
<binding name="netTcpBindingConfiguration"
closeTimeout="00:05:00"
openTimeout="00:05:00"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
transactionFlow="false"
transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard"
listenBacklog="10"
maxBufferPoolSize="2147483647 "
maxBufferSize="2147483647 "
maxConnections="10"
maxReceivedMessageSize="2147483647 "
>
<readerQuotas maxDepth="64" maxStringContentLength="2147483647 "
maxArrayLength="2147483647 " maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
</security>
</binding></netTcpBinding>
客户端:
<binding name="NetTcpBinding_IServerTest" closeTimeout="00:10:00"
openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>- 已编辑 hkkk 2012年11月28日 1:24
答案
-
你好,
服务端的“netTcpBindingConfiguration”绑定应用到服务端的终结点上了吗?客户端也一样,“NetTcpBinding_IServerTest”要应用到相应的终结点上。
<endpoint bindingConfiguration="netTcpBindingConfiguration" binding="netTcpBinding" contract="yourcontract" />
如果这些都设置正确问题仍然存在,试一下使用basicHttpBinding看有没有问题。Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
- 已标记为答案 hkkk 2012年11月30日 3:46
全部回复
-
你好,
服务端的“netTcpBindingConfiguration”绑定应用到服务端的终结点上了吗?客户端也一样,“NetTcpBinding_IServerTest”要应用到相应的终结点上。
<endpoint bindingConfiguration="netTcpBindingConfiguration" binding="netTcpBinding" contract="yourcontract" />
如果这些都设置正确问题仍然存在,试一下使用basicHttpBinding看有没有问题。Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework
- 已标记为答案 hkkk 2012年11月30日 3:46
-
你好,
服务端的“netTcpBindingConfiguration”绑定应用到服务端的终结点上了吗?客户端也一样,“NetTcpBinding_IServerTest”要应用到相应的终结点上。
<endpoint bindingConfiguration="netTcpBindingConfiguration" binding="netTcpBinding" contract="yourcontract" />
如果这些都设置正确问题仍然存在,试一下使用basicHttpBinding看有没有问题。
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework