1

BMPファイルをWCFサービスのパラメーターとして渡そうとしています。BMPファイルのサイズが350kbの場合、エラーが発生します。10〜20 kbの小さなファイルを渡すと、完全に実行されます。

The remote server returned an unexpected response: (413) Request Entity Too Large. 

[OperationContract]
byte[] ConvertData(Bitmap bmp);

次のリンクに従ってIIS設定を変更することで問題を解決しようとしました:http://blogs.msdn.com/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can -t-upload-large-files-using-iis6.aspxですが、運がありません

私のサーバーweb.configは

<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime executionTimeout="240000"/>    
</system.web>

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="BasicHttpBinding_IService1" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"  hostNameComparisonMode="StrongWildcard" maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
            </binding>
        </wsHttpBinding>
    </bindings>
    <services>
        <service name="ReDrawImgService.Service1">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="" contract="ReDrawImgService.IService1"/>
        </service>
    </services>

    <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="false"/>

            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

私のクライアントWeb.Configは

<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime executionTimeout="240000"/>

</system.web>

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="BasicHttpBinding_IService1" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"  hostNameComparisonMode="StrongWildcard" maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
            </binding>
        </wsHttpBinding>
    </bindings>
    <services>
        <service name="ReDrawImgService.Service1">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="" contract="ReDrawImgService.IService1"/>
        </service>
    </services>

    <client>
        <endpoint address="http://localhost:8012/Service1.svc" binding="wsHttpBinding"
            bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceClient.IService1"
            name="BasicHttpBinding_IService1" />
    </client>
</system.serviceModel>
4

1 に答える 1

1

readerQuotasで、maxStringContentLengthも2147483647に設定し、この構成が両端で設定されていることを確認してください。

したがって、サーバーとクライアントの両方がこれらの値を持つ必要があります。クライアントが大きなファイルの送信を許可されている場合、サーバーがとにかくそれを拒否する場合は、役に立ちません。

maxArrayLengthwcfサーバーアプリケーションの値は何ですか

于 2013-02-26T08:28:18.943 に答える