向WCF传递大于8K的字符串(xml字符串)的问题

red_guitar 2011-11-22 03:14:41
悲催,弄了半天还是大于8K就不行,wcf的web.config配置如下(新手没分~~~):
<bindings>
<basicHttpBinding>
<binding name="flowbinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
<security mode="None">
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="JPMFlowService.JPMFlowService">
<endpoint address="http://localhost:2449/JPMFlowService.svc" binding="basicHttpBinding" bindingConfiguration="flowbinding"
contract="JPMFlowService.JPMFlowService" />
</service>
</services>
...全文
223 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IJPMFlowService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:2449/JPMFlowService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IJPMFlowService"
contract="ServiceReference1.IJPMFlowService" name="BasicHttpBinding_IJPMFlowService" />
</client>
</system.serviceModel>
</configuration>

[Quote=引用 12 楼 moxcm 的回复:]

你贴出来的代码是服务器端的,你试试配置一下客户端的配置(也就是调用端的配置)
[/Quote]
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IJPMFlowService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:2449/JPMFlowService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IJPMFlowService"
contract="ServiceReference1.IJPMFlowService" name="BasicHttpBinding_IJPMFlowService" />
</client>
</system.serviceModel>
</configuration>

[Quote=引用 12 楼 moxcm 的回复:]

你贴出来的代码是服务器端的,你试试配置一下客户端的配置(也就是调用端的配置)
[/Quote]
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
客户端调用代码:
private void button1_Click(object sender, EventArgs e)
{

ServiceReference1.JPMFlowServiceClient server = new ServiceReference1.JPMFlowServiceClient();

string flowXML = "";
StreamReader sr = new StreamReader(@"C:\Documents and Settings\Administrator\桌面\flow.txt", System.Text.Encoding.Default);
flowXML = sr.ReadToEnd();
server.UpdateFlow(flowXML);
}
moxcm 2011-11-22
  • 打赏
  • 举报
回复
你贴出来的代码是服务器端的,你试试配置一下客户端的配置(也就是调用端的配置)
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
大牛们 求解啊。。。。
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
没有用ajax 客户端是一个winform项目,直接调用的服务方法[Quote=引用 9 楼 linus2008117 的回复:]

你用的ajax调用?
[/Quote]
linus2008117 2011-11-22
  • 打赏
  • 举报
回复
你用的ajax调用?
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
设置了这个也不行,这个默认页是4M,传个字符串才8K。解决方案全说改个wcf端配置就OK,悲催的是改了还是不行。[Quote=引用 7 楼 linus2008117 的回复:]

wcf 如果是在iis中的话有关系。
[/Quote]
linus2008117 2011-11-22
  • 打赏
  • 举报
回复
wcf 如果是在iis中的话有关系。
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
是往wcf传递一个大于8k的字符串,和这个有关系?[Quote=引用 5 楼 linus2008117 的回复:]

那个8k文件上传下,看第二次能否上传。

如还能上传 在webconfig里设置 httpRuntimemaxRequestLength 看下
[/Quote]
linus2008117 2011-11-22
  • 打赏
  • 举报
回复
那个8k文件上传下,看第二次能否上传。

如还能上传 在webconfig里设置 httpRuntimemaxRequestLength 看下
shaoxingss 2011-11-22
  • 打赏
  • 举报
回复
学习了,希望能和楼主多交流,以后常来往
http://hi.csdn.net/space.html
red_guitar 2011-11-22
  • 打赏
  • 举报
回复
3q。。。。[Quote=引用 2 楼 hetengfei_ 的回复:]

继续帮顶!
[/Quote]

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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