C# 实体过大错误

C# 实体过大错误,c#,wcf,C#,Wcf,我的服务有点问题。它不支持大量数据,我必须为它发送一个用base64编码的图像。 服务配置如下所示: [OperationContract] [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "create", BodyStyle = WebMessageBodyStyle.Bare)] WSResult&

我的服务有点问题。它不支持大量数据,我必须为它发送一个用base64编码的图像。 服务配置如下所示:

[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "create", BodyStyle = WebMessageBodyStyle.Bare)]
WSResult<WebService.Model.Order> create(WSOrderCreateParams paramsData);
[运营合同]
[WebInvoke(Method=“POST”,RequestFormat=WebMessageFormat.Json,ResponseFormat=WebMessageFormat.Json,UriTemplate=“create”,BodyStyle=WebMessageBodyStyle.Bare)]
WSResult创建(WSOrderCreateParams paramsData);
而web.config具有以下配置:

<system.web>
    <compilation targetFramework="4.5" debug="true" />
    <httpRuntime targetFramework="4.5" maxRequestLength="1000000000"/>
<system.web>
...
<service.serviceModel>
...
  <webHttpBinding>
    <binding name="WebHttpEndpointBinding"
      maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
      transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647"
        maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </webHttpBinding>
...
</service.serviceModel>
...
<services>
  <service name="WebService.ws.Order">
    <endpoint address="" behaviorConfiguration="Web" binding="webHttpBinding" contract="WebService.ws.IOrder"/>
  </service>
</services>

...
...
...
...

有人能帮我吗?

我已经通过网络配置解决了。这就是Web.config现在的状态:

<system.web>
  <compilation targetFramework="4.5" debug="true" />
  <httpRuntime targetFramework="4.5" maxRequestLength="1000000000"/>
<system.web>
    ...
<service.serviceModel>
  ...
  <webHttpBinding>
    <binding name="WebHttpEndpointBinding"
      maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
      transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647"
        maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </webHttpBinding>
  ...
</service.serviceModel>
    ...
<services>
  <service name="WebService.ws.Order">
    <endpoint address="" bindingConfiguration="WebHttpEndpointBinding" behaviorConfiguration="Web" binding="webHttpBinding" contract="WebService.ws.IOrder"/>
  </service>
</services>
...
<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="1073741824" />
    </requestFiltering>
  </security>
  <serverRuntime uploadReadAheadSize="2147483647" />
</system.webServer>

...
...
...
...
...
我在服务中添加了bindingConfiguration,如@kei所说,并且

<serverRuntime uploadReadAheadSize="2147483647" /> 


在system.webServer上。默认的IIS池不允许您使用uploadReadAheadSize,因此您必须继续:IIS管理器>配置编辑器>部分:system.webServer/serverRuntime>解锁部分。这样做,它应该可以工作:)

您是否尝试过将文件拆分成块,并让web服务将它们重新组合在一起?在您的
上,尝试添加
bindingConfiguration=“WebHttpEndpointBinding”
@javisrk,我该如何做?@kei,尝试过,但是不起作用有一个使用HTML5文件API上传块的例子-服务器例子是PHP,但客户端例子是标准javascript。