well the tag not net formed asp c# asp.net wcf iis file-upload

c# - the server tag is not well formed asp net



Carga de archivos, el servidor remoto devolvió un error:(413) Solicitar entidad demasiado grande (1)

Probablemente necesite actualizar los límites de solicitud de IIS en la sección System.WebServer, el valor predeterminado es 30 MB.

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="30000001" /> </requestFiltering> </security> </system.webServer> </configuration>

Más información aquí:

http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits

Puede hacer esto usando el Editor de configuración en IIS.

Para acceder a esto, seleccione el sitio web en el Administrador de IIS, luego seleccione Editor de configuración, en la Sección de administración. Profundice en la sección requestLimits, y puede actualizar la configuración allí, como se muestra en la siguiente captura de pantalla. Recuerde hacer clic en "Aplicar". Esto actualizará Web.Config en la raíz de la aplicación.

Dependiendo de su proceso de implementación, este cambio podría perderse en la próxima versión, por lo que vale la pena considerar la actualización de sus configuraciones en el control de la fuente.

Cuando cargo un archivo a través de los servicios de WCF, recibí la excepción, "El servidor remoto devolvió un error: (413) Entidad de solicitud demasiado grande"

Hay muchas preguntas y respuestas sobre esta excepción. Pero, ninguno de ellos está resuelto mi problema.

Estoy usando Windows Web Server 2008 R2, IIS 7.5. Mi cliente y las aplicaciones WCF están alojadas en IIS. Estoy usando el canal para llamar al servicio WCF.

var binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = Int32.MaxValue; binding.MaxBufferPoolSize = Int32.MaxValue; binding.MaxBufferSize = Int32.MaxValue; binding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue; binding.ReaderQuotas.MaxArrayLength = Int32.MaxValue; binding.ReaderQuotas.MaxBytesPerRead = Int32.MaxValue; binding.ReaderQuotas.MaxDepth = Int32.MaxValue; binding.ReaderQuotas.MaxNameTableCharCount = Int32.MaxValue; var address = new EndpointAddress("WCF Service URL"); return ChannelFactory<IFileService>.CreateChannel(binding, address);

Archivo de configuración WCF como el siguiente:

<system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="behavior1"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service name="MyProject.WCF.FileService" behaviorConfiguration="behavior1"> <endpoint binding="basicHttpBinding" bindingName="binding1" contract="MyProject.WCF.Contracts.Service.IFileService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <bindings> <basicHttpBinding> <binding name="binding1" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> </binding> </basicHttpBinding> </bindings> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel>

Además, agrego el archivo web.config del cliente las siguientes configuraciones:

<httpRuntime maxRequestLength="2097151" /> <serverRuntime uploadReadAheadSize="2147483647" /> <security> <requestFiltering> <requestLimits maxAllowedContentLength="2147483648" /> </requestFiltering> </security>

Cambié C: / Windows / System32 / inetsrv / config / applicationHost.config,

<location path="My Site Path" overrideMode="Allow"> <system.webServer> <httpLogging dontLog="true" /> <serverRuntime uploadReadAheadSize="2147483647" /> </system.webServer> </location>

Pero, ninguno de ellos está resuelto mi problema. No hay problema con Windows Server 2012. Probablemente, el problema esté relacionado con Windows Server 2008. ¿Cómo puede cargar archivos grandes con WCF en Windows Server 2008?

Gracias.