2010-03-19 17 views
5

... Neredeyse google ama I stackoverflow belirtilen tüm yöntemleri denedim hala cant nerede olduğumu öğrenmek ! ters gidiyor .... ben belirttinizWCF REST hizmete büyük xml yükleyerek -> 400 Geçersiz istek ben REST hizmetine büyük xml dosya yüklemek çalışıyorum

.. 64 kb daha maxRequestLength bir dosya daha yükleyemezsiniz:

<httpRuntime maxRequestLength="65536"/> 

ve aşağıdaki gibi benim bağlayıcı yapılandırma geçerli:

<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> 

İçinde Aşağıdaki yapıyorum benim C# istemci tarafı: Fiddler denedi

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); 
     } 

istemci tarafında yapılan hiçbir özel yapılandırma yoktur ...

... istemci uygun bir istek gönderiyor .. sunucu hemen .. bir 400 ile yanıt .Ama

+0

@marc_s: Ben de aynısını düşünüyordum ama docs "azami istek boyutu kilobayt [dir]" göre edildi. http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx –

cevap

0

oldu:

<binding name="uploadFilesBasicHttpBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" receiveTimeout="00:10:10" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00"> 
    <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/> 
    <security mode="TransportWithMessageCredential"> 
     <message clientCredentialType="UserName"/> 
    </security> 
    </binding> 
İlgili konular