Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过WCF服务上载大于8 MB的流_Wcf_Configuration_Wcf Binding_Webhttpbinding - Fatal编程技术网

通过WCF服务上载大于8 MB的流

通过WCF服务上载大于8 MB的流,wcf,configuration,wcf-binding,webhttpbinding,Wcf,Configuration,Wcf Binding,Webhttpbinding,我试图使用REST配置(webHttpBinding)通过窗口服务上传照片(附件流),但我遇到了这个异常 这是我使用的绑定配置(我尝试了所有这些配置,错误仍然存在) 我还尝试了在这里发布的IIS解决方案 然而,以上所有这些都不起作用 以下是我的端点行为 <endpointBehaviors> <behavior name="rest"> <webHttp faultExceptionEnab

我试图使用REST配置(webHttpBinding)通过窗口服务上传照片(附件流),但我遇到了这个异常

这是我使用的绑定配置(我尝试了所有这些配置,错误仍然存在)


我还尝试了在这里发布的IIS解决方案

然而,以上所有这些都不起作用

以下是我的端点行为

      <endpointBehaviors>
        <behavior name="rest">
          <webHttp faultExceptionEnabled="true" helpEnabled="true"/>
          <dataContractSerializer maxItemsInObjectGraph="1365536" />
        </behavior>
      </endpointBehaviors>

这是合同


有关更多信息,图像大小仅为100KB。

WCF默认传输消息大小为64KB,您需要使用MaxReceivedMessageSize设置传输消息大小

<system.serviceModel>
    <services>

        <service name="ConsoleApp1.RawDataService" behaviorConfiguration="ServiceBehavior">
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:8012/ServiceModelSamples/service"/>
                </baseAddresses>
            </host>

            <endpoint address=""
                      binding="webHttpBinding"
                      contract="ConsoleApp1.IReceiveData"
                      behaviorConfiguration="ESEndPointBehavior" bindingConfiguration="RestfullwebHttpBinding"/>
        </service>
    </services>
    <bindings>
        <webHttpBinding>
            <binding name="RestfullwebHttpBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
            </binding>
        </webHttpBinding>
    </bindings>
    
    
    <behaviors>
        <endpointBehaviors>
            <behavior name="ESEndPointBehavior">
                <webHttp helpEnabled="true"/>
            </behavior>
        </endpointBehaviors>

        <serviceBehaviors>
            <behavior name="ServiceBehavior">
                <serviceMetadata/>
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>

    </behaviors>

</system.serviceModel>


如果问题仍然存在,请随时通知我。

您好,问题解决了吗?如果你认为我的回答对你有帮助,你可以把它标记为回答。
<system.serviceModel>
    <services>

        <service name="ConsoleApp1.RawDataService" behaviorConfiguration="ServiceBehavior">
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:8012/ServiceModelSamples/service"/>
                </baseAddresses>
            </host>

            <endpoint address=""
                      binding="webHttpBinding"
                      contract="ConsoleApp1.IReceiveData"
                      behaviorConfiguration="ESEndPointBehavior" bindingConfiguration="RestfullwebHttpBinding"/>
        </service>
    </services>
    <bindings>
        <webHttpBinding>
            <binding name="RestfullwebHttpBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
            </binding>
        </webHttpBinding>
    </bindings>
    
    
    <behaviors>
        <endpointBehaviors>
            <behavior name="ESEndPointBehavior">
                <webHttp helpEnabled="true"/>
            </behavior>
        </endpointBehaviors>

        <serviceBehaviors>
            <behavior name="ServiceBehavior">
                <serviceMetadata/>
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>

    </behaviors>

</system.serviceModel>