2010-03-19 12 views
5

Estoy tratando de cargar archivos xml grandes a un servicio REST ... He intentado casi todos los métodos especificados en stackoverflow en google pero todavía no puedo averiguar dónde estoy va mal .... no puedo cargar un archivo mayor de 64 kb ..cargando xml grande al servicio WCF REST -> 400 Solicitud incorrecta

he especificado el maxRequestLength:

<httpRuntime maxRequestLength="65536"/> 

y mi configuración de unión es el siguiente:

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

En C# mi lado cliente que estoy haciendo lo siguiente:

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

No hay ninguna configuración especial que se hace en el lado del cliente ...

He tratado violinista ... El cliente envía una solicitud apropiada .. .Pero el servidor responde inmediatamente con un 400 ..

+0

@marc_s: Estaba pensando lo mismo, pero de acuerdo a los docs "el tamaño de solicitud máximo [es] en kilobytes". http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx –

Respuesta

0

Para WCF de SOAP todo lo que tenía que hacer era:

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