将大型xml上载到WCF REST服务 - > 400 Bad request

Gle*_*thi 5 c# rest upload wcf

我正在尝试将大型xml文件上传到REST服务...我已经尝试了在谷歌上的stackoverflow上指定的几乎所有方法,但我仍然无法找到我出错的地方....我无法上传大于64 kb的文件!..

我已经指定了maxRequestLength:

<httpRuntime maxRequestLength="65536"/>
Run Code Online (Sandbox Code Playgroud)

我的绑定配置如下:

<bindings>
  <webHttpBinding>
    <binding name="RESTBinding" maxBufferSize="67108864" maxReceivedMessageSize="67108864" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
    </binding>   
  </webHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)

在我的C#客户端,我正在做以下事情:

WebRequest request = HttpWebRequest.Create(@"http://localhost.:2381/RepositoryServices.svc/deviceprofile/AddDdxml");

        request.Credentials = new NetworkCredential("blah", "blah");
        request.Method = "POST";
        request.ContentType = "application/xml";
        request.ContentLength = byteArray.LongLength;


        using (Stream postStream = request.GetRequestStream())
        {
            postStream.Write(byteArray, 0, byteArray.Length);
        }
Run Code Online (Sandbox Code Playgroud)

客户端没有特殊配置......

我试过fiddler ...客户端正在发送一个正确的请求...但服务器立即响应400 ..

Gle*_*thi 8

得到了我的回答!.... http://forums.asp.net/p/1375070/2887691.aspx ..... p !, ....花了2天的时间!