我是开发人员使用WCF服务的winform应用程序。某些形式在网格中显示100-200行。对于这种情况,它无法显示任何数据并给出此错误:
我已就此问题与SO讨论了很多问题。我尝试了大部分。但这没有运气。
我已将应用程序的app.config更改为:(更新)
<system.serviceModel>
<client>
<endpoint address="http://internaladmin.iifl.in/NBFCLAS/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INBFC"
contract="NbfcService.INBFC" name="BasicHttpBinding_INBFC" />
</client>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_INBFC" closeTimeout="00:59:00"
openTimeout="00:59:00" receiveTimeout="00:10:00" sendTimeout="00:59:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
但它仍然无效。我遇到同样的EXE文件的朋友面临着这样的问题,我没有遇到任何问题。
注意:WCF服务的webconfig中没有绑定部分。
WCF的Webconfig:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_INBFC" closeTimeout="00:59:00"
openTimeout="00:59:00" receiveTimeout="00:10:00" sendTimeout="00:59:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="NbfcService.INBFC">
<endpoint
binding="basicHttpBinding"
contract="NbfcService.INBFC"
bindingConfiguration="BasicHttpBinding_INBFC" />
</service>
</services>
答案 0 :(得分:0)
您必须在客户端&#39;和&#39;上设置maxReceivedMessageSize。在服务器上。在您的情况下,您需要更改服务器上的绑定以及在客户端上执行的绑定。
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_INBFC" closeTimeout="00:59:00"
openTimeout="00:59:00" receiveTimeout="00:10:00" sendTimeout="00:59:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="<My service name>">
<endpoint
binding="basicHttpBinding"
contract="<my contract name>"
bindingConfiguration="BasicHttpBinding_INBFC" />
</service>
</services>
</system.serviceModel>