简体   繁体   English

将大量JSON数据发布到WCF服务

[英]Post Large amount of JSON data to WCF Service

I am working with a .NET WCF Service, which accepts JSON data as an HTTP Post from another .NET application. 我正在使用.NET WCF服务,它从另一个.NET应用程序接受JSON数据作为HTTP Post。

When I post a small amount of data everything works fine ( ~ up to 65kb of data ) 当我发布少量数据时,一切正常(〜高达65kb的数据)

however when I try to post more than that, I get an Internal Server error on the service side. 但是当我尝试发布更多内容时,我在服务端出现内部服务器错误。

Everything points to the service being limited to accepting up to 65kb worth of data. 一切都指向服务仅限于接受高达65kb的数据。

I have read about modifying my config file to accept more data with the maxrequestmessagesize attribute, however my problem is that my web.config does not have any bindings that I can see. 我已阅读有关修改我的配置文件以接受更多数据与maxrequestmessagesize属性,但我的问题是我的web.config没有任何我能看到的绑定。

Here is what I have in my config file that relates to the service 这是我的配置文件中与服务相关的内容

<system.serviceModel>

    <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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

I am not sure what to do in order to get past that 65 k limit - Any help would be appreciated. 我不知道该怎么做以超过65 k的限制 - 任何帮助将不胜感激。

Thanks 谢谢

Use this in your config: 在配置中使用此选项:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_ImyService"
                maxBufferPoolSize="2147483647"
                maxReceivedMessageSize="2147483647">
            </binding>
        </basicHttpBinding>
    </bindings>

</system.serviceModel>

I just took a quick look and I have 4 settings in different places to "raise the request size bar" for my WCF service: 我只是快速浏览一下,我在不同的地方有4个设置为我的WCF服务“提高请求大小栏”:

maxarraylength (binding/readerquotas tag) maxbuffersize (binding tag) maxreceivedmessagesize (binding tag) maxrequestlength (system.web/httpruntime tag) maxarraylength(binding / readerquotas tag)maxbuffersize(binding tag)maxreceivedmessagesize(binding tag)maxrequestlength(system.web / httpruntime tag)

I'm not sure why there are no bindings in your config. 我不确定为什么配置中没有绑定。 Perhaps if not specified, then default values are used? 也许如果没有指定,那么使用默认值? Do you have any services/service/endpoint tags? 你有任何服务/服务/端点标签吗? Perhaps you're setting these via code? 也许你是通过代码设置这些?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM