2017-03-02 215 views
0

请不要删除其视为重复 我有我传递对象数组到一个窗口服务。当数组包含少于150个对象时,它可以成功运行。当我传递超过150个对象时,(413)请求实体太大错误。
我试图从有关readerQuotas节点值和maxReceivedMessageSize其他物品的反馈,但我仍然收到错误,我坚持的是什么,我还是做错了。 这里是窗口服务的app.config:Windows服务(413)请求实体过大

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="basicHttpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"> 
      <readerQuotas maxDepth="2000000000" 
        maxStringContentLength="2000000000" 
        maxArrayLength="2000000000" 
        maxBytesPerRead="2000000000" 
        maxNameTableCharCount="2000000000" /> 
      </binding> 
     </basicHttpBinding> 
     <wsHttpBinding> 
      <binding name="wsHttpBindingNoSecurity" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
       <security mode="None"> 
        <transport clientCredentialType="None"/> 
        <message establishSecurityContext="false" negotiateServiceCredential="false"/> 
       </security> 
       <readerQuotas maxDepth="2000000000" 
        maxStringContentLength="2000000000" 
        maxArrayLength="2000000000" 
        maxBytesPerRead="2000000000" 
        maxNameTableCharCount="2000000000" /> 
      </binding> 
     </wsHttpBinding> 
     <mexHttpBinding> 
      <binding name="mexHttpBinding"/> 
     </mexHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="Service1Behavior"> 
       <serviceMetadata httpGetEnabled="true"/> 
       <serviceDebug includeExceptionDetailInFaults="true"/> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service name="SE.Responder.Integration.AmiOutboundService.AmiObService" behaviorConfiguration="Service1Behavior"> 
      <endpoint address="wsHttp" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingNoSecurity" contract="SE.Responder.Integration.AmiOutboundService.IAmiObService"> 
       <identity> 
        <dns value="localhost"/> 
       </identity> 
      </endpoint> 
      <endpoint address="basicHttp" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" name="basicHttp" contract="SE.Responder.Integration.AmiOutboundService.IAmiObService"/> 
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
      <host> 
       <baseAddresses> 
        <add baseAddress="http://localhost:8732/SE.Responder.Integration.AmiOutboundService/AmiObService/"/> 
       </baseAddresses> 
      </host> 
     </service> 
    </services> 
</system.serviceModel> 

这里是可执行的是将数据传递到Windows服务的app.config:

<system.serviceModel> 
<bindings> 
    <wsHttpBinding> 
    <binding name="WSHttpBinding_IAmiObService" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" > 
     <readerQuotas maxDepth="2000000000" 
        maxStringContentLength="2000000000" 
        maxArrayLength="2000000000" 
        maxBytesPerRead="2000000000" 
        maxNameTableCharCount="2000000000" /> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<client> 
    <endpoint address="http://localhost:8732/SE.Responder.Integration.AmiOutboundService/AmiObService/AmiOBService" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAmiObService" contract="AmiObService.IAmiObService" name="WSHttpBinding_IAmiObService" /> 
</client> 

+0

我们将投票关闭为重复,如果它是一个重复的;如果不是,我们不会。要求我们不要改变这一点。 – Amy

+0

好吧,我用了一个很差的词。我想说明的是,我已经尝试了我在其他类似问题中发现的事情,但迄今未取得成功。 –

+0

如果我可以提供一些建议作为一个长期的时间,所以用户:当我问的SO一个问题,我试着从我怀疑可能被用作复制其他问题的解决方案,我举我的问题这些问题随着简要说明它所说的做法以及它如何解决我的问题。诚然,这可能会帮助它更快地关闭*,但根据我的经验,如果我的问题实际上不是重复的,它不会被关闭,这样做可以帮助我们更快地找到解决方案。 – Amy

回答

0

后回顾有此问题的应用程序的源代码,我发现wcf服务托管在C#代码中。如下面的堆栈溢出问题描述我然后施加在码修复, MaxReceivedMessageSize in WCF Hosted Service in console application, 特别以下行, VAR的wsHttpBinding =新的WSHttpBinding(); wsHttpBinding.MaxReceivedMessageSize = int.MaxValue; Service.AddServiceEndpoint(typeof(TInterfaceContract),wsHttpBinding,EndpointAddress);

它修正了该问题。

相关问题