Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.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
C# 即使使用正确的web.config,WCF消息也太大_C#_Wcf_Http_Web Config_Basichttpbinding - Fatal编程技术网

C# 即使使用正确的web.config,WCF消息也太大

C# 即使使用正确的web.config,WCF消息也太大,c#,wcf,http,web-config,basichttpbinding,C#,Wcf,Http,Web Config,Basichttpbinding,我有一个具有以下web.config的WCF服务: <?xml version="1.0"?> <configuration> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="MetadataExchange"> <serviceMetadata httpGetEnabl

我有一个具有以下web.config的WCF服务:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MetadataExchange">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="LargeHttpBinding" maxBufferSize="5064536" maxBufferPoolSize="5064536" maxReceivedMessageSize="5064536">
          <readerQuotas maxDepth="32" maxStringContentLength="5064536" maxArrayLength="5064536" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="MetadataExchange" name="Service.Interface.ApplicationService.ApplicationService">
        <endpoint name="httpEndpoint" address="" binding="basicHttpBinding" bindingConfiguration="LargeHttpBinding" contract="Service.Proxy.ApplicationService.Interfaces.IApplicationService" />
        <endpoint name="mexEndpoint" address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:15000/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <client>
      <endpoint name="httpEndpoint" address="http://localhost:15000/ApplicationService/ApplicationService.svc" binding="basicHttpBinding" bindingConfiguration="LargeHttpBinding" contract="Service.Proxy.ApplicationService.Interfaces.IApplicationService" />
    </client>
  </system.serviceModel>
  <system.webServer>
    <!--ToDo: Set directory browse to false-->
    <directoryBrowse enabled="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>
</configuration>
如果我尝试发送大小约为150kb的图片,将抛出一条错误消息,并显示以下消息:

远程服务器返回意外响应:(413)请求实体太大


我是个白痴!测试图片的大小太大了。。。它的尺寸为1920*1080,大小为167kb。但是如果我把它转换成字节数组,它的大小是8MB,因为2073600像素乘以4(a,r,g,b)。。。我应该删除这个问题吗?我是个白痴!测试图片的大小太大了。。。它的尺寸为1920*1080,大小为167kb。但是如果我把它转换成字节数组,它的大小是8MB,因为2073600像素乘以4(a,r,g,b)。。。我应该删除这个问题吗?
basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.MaxBufferSize = 5064536;
basicHttpBinding.MaxBufferPoolSize = 5064536;
basicHttpBinding.MaxReceivedMessageSize = 5064536;
basicHttpBinding.ReaderQuotas.MaxDepth = 32;
basicHttpBinding.ReaderQuotas.MaxStringContentLength = 5064536;
basicHttpBinding.ReaderQuotas.MaxArrayLength = 5064536;
basicHttpBinding.ReaderQuotas.MaxBytesPerRead = 4096;
basicHttpBinding.ReaderQuotas.MaxNameTableCharCount = 16384;