0

イメージをバイト配列として保存するための WCF サービスを作成しました。以下は、契約、実装、およびエンポイントの詳細です

契約

  [OperationContract]
        void InsertEmployeeData(EmployeeDetail empName);

実装

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

15 kb 未満を保存しようとすると、正常に保存できます。15 kb 以上をアップロードすると、例外が発生しました。リモート サーバーが予期しない応答を返しました: (400) Bad Requestこのエラーを解決するにはどうすればよいですか?

バインディングの詳細

<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 に答える