0

我创建了一个 WCF 服务,用于将图像保存为字节数组。以下是合同、实施和委托细节

合同

  [OperationContract]
        void InsertEmployeeData(EmployeeDetail empName);

执行

 public void InsertEmployeeData(EmployeeDetail empName)
        {
            ctx.EmployeeDetails.AddObject(empName);
            ctx.SaveChanges();
        }

当我尝试保存低于 15 kb 时,我可以成功保存。上传超过 15 kb 时出现异常远程服务器返回意外响应:(400)错误请求我该如何解决这个错误?

装订细节

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ImobService" closeTimeout="00:10:00"
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          maxBufferSize="250000000" maxBufferPoolSize="250000000" maxReceivedMessageSize="250000000">
          <readerQuotas maxDepth="4500000" maxStringContentLength="4500000"
            maxArrayLength="4500000" maxBytesPerRead="40960000" maxNameTableCharCount="250000000" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://anishk.india-powai.orioninc.com/mobservice/MobService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ImobService"
        contract="MobileService.ImobService" name="BasicHttpBinding_ImobService" />
    </client>
  </system.serviceModel>
4

1 回答 1

0

如果您在 IIS 上托管服务,则请求长度限制为 15 kb 是一个很好的变化。尝试更改 IIS 设置

<httpRuntime maxRequestLength="25000" /> 

将请求长度更改为最大值。您要上传的文件大小。

于 2013-01-25T13:55:58.150 回答