开发者

Sending large chunks of data over WCF service

[DataCont开发者_StackOverflow社区ract]
public class Request
    [DataMember]
    public int ID { get; set; }
    [DataMember]
    public string Data { get; set; }
}

public Response ProcessData(Request request)
{
    //do something with request.Data
}

on the client

string data = [some large data];
server.ProcessData(new Request() {ID=1, Data=data});

It works well if I pass a smaller string. But when I read a text file and pass the content of it it throws an error 'Bad Request 400'.

Update: It works now. The following entry in the web.config on the wcf server did the trick.

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
          <security mode="None"/>
        </binding>
      </basicHttpBinding>
    </bindings>
</system.serviceModel>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜