WebService问题
自己写了一个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; [color=#FF0000]ServiceReference1.PageInputPortalSrvResponse response = test.Process(request);[/color] DateTime d2 = DateTime.Now; TimeSpan time = d2 - d1; Console.WriteLine("Time:" + time.Milliseconds.ToString()); Console.ReadKey();
<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>