简体   繁体   English

发送大字节[]到WCF

[英]Sending large byte[] to WCF

This question has asked sevaral times on SO. 这个问题已经问过SO的时间了。 But I cannot understand the solutions. 但是我不明白解决方案。
I have WCF service which is implemented to save file sent from client. 我有WCF服务,用于保存从客户端发送的文件。 It is working well with 10kb 10kb运作良好
This is not suffitiant for me. 这对我来说并不足够。 How to enhance this to work with 100MB. 如何使用100MB增强此功能。

  <binding name="BasicHttpBinding_IUpload" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" maxBufferPoolSize="64000000" maxReceivedMessageSize="64000000" transferMode="Streamed">
      <readerQuotas maxDepth="32" maxStringContentLength="64000000" maxArrayLength="64000000" maxBytesPerRead="64000000" maxNameTableCharCount="64000000" />
  </binding>

I got this exception when sending big file 发送大文件时出现此异常

The remote server returned an unexpected response: (413) Request Entity Too Large. 远程服务器返回了意外的响应:(413)请求实体太大。

EDITED 已编辑

 <endpoint address="http://localhost:82/Upload/Upload.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUpload"
    contract="DatabaseService.IUpload" name="BasicHttpBinding_IUpload" />

You have to change your web.config to accept large request: 您必须更改web.config才能接受大请求:

<system.web>
  <httpRuntime 
    executionTimeout="90" 
    maxRequestLength="110000" 
  />
 ...

maxRequestLength is default 4096 (4mb), change it to 110000 to accept just over 100mb. maxRequestLength是默认值4096(4mb),将其更改为110000以接受刚好超过100mb。 And make sure your executionTimeout is large enough (in seconds). 并确保您的executionTimeout足够大(以秒为单位)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM