问题描述
我正在为我的大学管理项目制作一个网络服务(Wcf)。当我从数据库收到大量数据时遇到一些困难它给了我以下例外
异常:已超出传入邮件的最大邮件大小限额(65536)。要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性
$ b $我知道这个异常我修改了我的web.config以便我可以这里接收大量数据是我的web.config:
i am making a web service(Wcf) for my university management project.i am having some difficulties when i receive large amount of data from database it gives me following exception
Exception: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element
i am aware of this exception i have modified my web.config so that i can receive large amount of data here is my web.config:
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
<endToEndTracing activityTracing="true" />
</diagnostics>
<bindings>
<wsHttpBinding>
<binding name="secureWsHttpBinding" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="524288000" messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None" />
<message algorithmSuite="TripleDes" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<protocolMapping>
<remove scheme="http" />
<add scheme="https" binding="wsHttpBinding" bindingConfiguration="secureWsHttpBinding"/>
</protocolMapping>
i在我的服务器端web.config文件中设置了最大值
修改我的web.config后我更新了我的服务参考和visual studio生成我的客户端配置在app.config中
这是我的app.config文件:
i have set maximum values in my server side web.config file
after modifying my web.config i updated my Service Reference and visual studio Generate my Client side configuration in app.config
here is my app.config file :
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IAcdmcYrAdding" messageEncoding="Mtom">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="WSHttpBinding_IAdd_EmployeeRecord" messageEncoding="Mtom">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<endpoint address="https://khurram/AlahsaanDSL.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IAcdmcYrAdding" contract="DSL.IAcdmcYrAdding"
name="WSHttpBinding_IAcdmcYrAdding" />
<endpoint address="https://khurram/AlahsaanDSL.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IAdd_EmployeeRecord" contract="DSL.IAdd_EmployeeRecord"
name="WSHttpBinding_IAdd_EmployeeRecord" />
</client>
</system.serviceModel>
注意:在我的客户端配置中我有很多绑定和端点我做不想配置每个终点。
**我的问题: - Visual Studio是否有任何方式生成我的app.config文件,如* *
Note: in my Client Configuration i have lots of bindings and endpoints i do not want to configure every end point.
**My Question:- Is there any way by which visual studio generate my app.config file like this**
<binding name="WSHttpBinding_IAcdmcYrAdding" maxBufferPoolSize="2147483647"maxReceivedMessageSize="2147483647"messageEncoding="Mtom"><readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
推荐答案
这篇关于如何通过Visual Studio 2013根据服务器端的web.config覆盖客户端app.config的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!