2012-02-26 36 views

Respuesta

15

Si usted trabaja por cuenta de hosting, es parte de la clase HttpSelfHostConfiguration: MSDN Documentation of the HttpSelfHostConfiguration class

que sería utilizado como esto:

var config = new HttpSelfHostConfiguration(baseAddress); 
config.MaxReceivedMessageSize = int.MaxValue; 
config.MaxBufferSize = int.MaxValue; 
+0

Gracias, pero quiero alojar en Asp.Net. Solía ​​haber una clase de WebApiConfiguration – suing

+5

¡Infierno sí! 2 GB de mensajes grandes FTW !!! – Henrik

+0

Parece una solución probable, tendré que probarla. Ya el recurso derecho de 2gb en un servicio REST está loco. Tenemos servicios de grano grueso que odio son ~ 5 mb por mensaje. ¡¡¡Yuck !!! – suing

14

Es posible que desee ver en httpRuntime sección en web.config de su aplicación ASP.NET. No se nombran exactamente igual, pero puede haber un análogo para lo que estás tratando de hacer. Por ejemplo:

<configuration> 
    <system.web> 
    <httpRuntime maxRequestLength="16384" requestLengthDiskThreshold="16384"/> 
    </system.web> 
</configuration> 

Nota: Int32.MaxValue es 2147483647

+1

esto es para la solicitud de no respuesta. –

4
primera

que yo hubiera hecho esta configuración en el WCF App.config

<endpoint address ="" binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="AddSubService.IService1"> 
     <!-- 
      Upon deployment, the following identity element should be removed or replaced to reflect the 
      identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
      automatically. 
     --> 
     <identity> 
     <dns value="localhost"/> 
     </identity> 
    </endpoint> 

    <!-- Metadata Endpoints --> 
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
    </service> 

</services> 

<bindings> 
    <basicHttpBinding> 
    <binding name="basicHttp" allowCookies="true" 
      maxReceivedMessageSize="20000000" 
      maxBufferSize="20000000" 
      maxBufferPoolSize="20000000"> 
     <readerQuotas maxDepth="32" 
      maxArrayLength="200000000" 
      maxStringContentLength="200000000"/> 
    </binding> 
    </basicHttpBinding> 
</bindings> 

A continuación, intente updaeting la referencia en el lado ASP.NET que llama a WCF en la comprobación web.config de que el punto final ha cambiado al mismo.

-1

puedo solucionar este problema haciendo una unión antes como esto

BasicHttpBinding bind = new BasicHttpBinding(); 
bind.OpenTimeout = bind.CloseTimeout = bind.SendTimeout = bind.ReceiveTimeout = new TimeSpan(0, 30, 0); 
bind.MaxBufferSize = int.MaxValue; 
bind.MaxReceivedMessageSize = int.MaxValue; 
Cuestiones relacionadas