【发布时间】:2014-02-10 09:00:01
【问题描述】:
我正在尝试正确设置我的 App.Config 以允许我的 NetTcp 服务返回大于 65536 的字符串,因为我在下面收到此错误
传入邮件的最大邮件大小配额 (65536) 已达到 超过。要增加配额,请使用 MaxReceivedMessageSize 相应绑定元素上的属性。
到目前为止,这是我尝试过的,但它不起作用,我希望有人能指出我的错误
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="NetTcpSHWS.Service1" behaviorConfiguration="NetTcpSHWS.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress = "net.tcp://localhost:8732/Design_Time_Addresses/NetTcpSHWS/Service1/" />
</baseAddresses>
</host>
<endpoint name="NetRcpEndPoint" address ="" binding="netTcpBinding" bindingConfiguration="netMyConfig" contract="NetTcpSHWS.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint name="NetTcpMetadataPoint" address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="NetTcpSHWS.Service1Behavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="False" />
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netMyConfig"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
transferMode="Buffered">
<readerQuotas maxDepth="32"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
这只是一个测试应用
【问题讨论】:
-
我使用建议的更改更新了原始帖子的配置设置,但我仍然收到错误
-
如何启动服务?
-
不,我只是通过 vs 工具本地化了它,但我意识到我从未配置过我的客户端,这就是为什么我仍然遇到问题,facepalm
标签: c# wcf nettcpbinding