WebService问题

Justin-Liu
博客专家认证
2010-04-29 03:37:08
自己写了一个WebService,发布后在一个命令行程序里面调用 即SOAP方式调用WebService

出现错误:

Maximum message size quota for incoming messages (65536) has been exceeded.

中文为 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。

网上说有修改WebConfig的方法,尝试了 未果 求解

代码


ServiceReference1.PageInputPortalSrvRequest request = new PortalWSTest.ServiceReference1.PageInputPortalSrvRequest();
#region structure request
ServiceReference1.MsgHeader msgHeader = new PortalWSTest.ServiceReference1.MsgHeader();
msgHeader.SUBMITDATE = DateTime.Now.ToLocalTime();
msgHeader.SOURCESYSTEMID = "SourceSystemID";
request.MsgHeader = msgHeader;
ServiceReference1.WaitLineInfo[] waitLines = new PortalWSTest.ServiceReference1.WaitLineInfo[1000];
for (int i = 1; i <= 1000; i++)
{
ServiceReference1.WaitLineInfo waitLine = new PortalWSTest.ServiceReference1.WaitLineInfo();
waitLine.WAITID = "testForWS" + i.ToString();
waitLine.USERNAME = "UserName" + i.ToString();
waitLine.SENDER = "Sender" + i.ToString();
waitLine.URL = "URL" + i.ToString();
//if (i >= 6)
//{
waitLine.STATUS = "1";
//}
//else
//{
// waitLine.STATUS = "0";
//}
waitLine.TITLE = "Title" + i.ToString();
waitLines[i - 1] = waitLine;
}
request.WAITLINES = waitLines;
#endregion

ServiceReference1.PageInputPortalSrvSoapClient test = new PortalWSTest.ServiceReference1.PageInputPortalSrvSoapClient();

DateTime d1 = DateTime.Now;
ServiceReference1.PageInputPortalSrvResponse response = test.Process(request);
DateTime d2 = DateTime.Now;
TimeSpan time = d2 - d1;
Console.WriteLine("Time:" + time.Milliseconds.ToString());
Console.ReadKey();


在线静候
...全文
289 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
Fromjack 2011-04-19
  • 打赏
  • 举报
回复
不错 呵呵
Justin-Liu 2010-04-29
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 wiki14 的回复:]
修改Web.Config文件,其中的MaxReceivedMessageSize


C# code

<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="CalculatorBinding" maxBufferPoolSize="2000000"
maxRece……
[/Quote]
是客户端调用的app.config
你加我群了没 ? 快加
wiki14 2010-04-29
  • 打赏
  • 举报
回复
修改Web.Config文件,其中的MaxReceivedMessageSize


<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="CalculatorBinding" maxBufferPoolSize="2000000"
maxReceivedMessageSize="2000000000" >
<security mode="Transport" >
<transport clientCredentialType="Windows" />
</security>
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000"
maxArrayLength="2000000"
maxBytesPerRead="2000000"
maxNameTableCharCount="2000000" />
</binding>
</wsHttpBinding>

</bindings>

lester19872007 2010-04-29
  • 打赏
  • 举报
回复
昏迷,大小改了没?
Justin-Liu 2010-04-29
  • 打赏
  • 举报
回复
调用端的APP.CONFIG修改之后就好用了 一直忽略了 二了。。。
Justin-Liu 2010-04-29
  • 打赏
  • 举报
回复
再详细描述一下:发布(本地的一个site)完WebService后,新建了一个命令行工程,通过添加服务引用去添加发布的WebService,代码就是上面的。 错误也是上面的。
awesomeo 2010-04-29
  • 打赏
  • 举报
回复
<configuration><system.serviceModel><bindings><basicHttpBinding>
<binding ...>
...
</binding>
</basicHttpBinding></bindings></system.serviceModel></configuration>
Justin-Liu 2010-04-29
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 sxmonsy 的回复:]
在Web.config中设置MaxReceivedMessageSize 这个值试试。
[/Quote]
我那个webconfig里头没有那个节点
Justin-Liu 2010-04-29
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 awesomeo 的回复:]
<binding name="BasicHttpBinding_DataProcessorService"
maxBufferSize="6553600" maxBufferPoolSize="6553600" maxReceivedMessageSize="6553600">
<readerQuotas maxDepth="32" maxStringContentLength="6……
[/Quote]
你写的这两个 加在webconfig的哪个位置?
awesomeo 2010-04-29
  • 打赏
  • 举报
回复
<binding name="BasicHttpBinding_DataProcessorService"
maxBufferSize="6553600" maxBufferPoolSize="6553600" maxReceivedMessageSize="6553600">
<readerQuotas maxDepth="32" maxStringContentLength="6553600" maxArrayLength="6553600"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>

把buffersize也改大。
awesomeo 2010-04-29
  • 打赏
  • 举报
回复
<readerQuotas maxDepth="32" maxStringContentLength="6553600" maxArrayLength="6553600"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />

不够再加!
sxmonsy 2010-04-29
  • 打赏
  • 举报
回复
在Web.config中设置MaxReceivedMessageSize 这个值试试。
Justin-Liu 2010-04-29
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 y_sc1413 的回复:]
参考楼上!
[/Quote]
LS不行~
y_sc1413 2010-04-29
  • 打赏
  • 举报
回复
参考楼上!
lester19872007 2010-04-29
  • 打赏
  • 举报
回复
修改Web.Config文件,其中的MaxReceivedMessageSize

可以改大一点,改成2147483647好了。


<system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicAuthEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="Transport"> <transport clientCredentialType="Basic" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding>

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/faunjoe/archive/2009/10/06/4636074.aspx

liaoyukun111 2010-04-29
  • 打赏
  • 举报
回复
没有高过 帮顶
porschev 2010-04-29
  • 打赏
  • 举报
回复
就是超过最大范围了。。。改长点应该就行了啊。。。
messi_yang 2010-04-29
  • 打赏
  • 举报
回复
不會
幫你頂哈 ···
兔子-顾问 2010-04-29
  • 打赏
  • 举报
回复
沙发。回复肯定太短了。

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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