Enviando imagens para o sql server (Request Entity Too Large.)

02/08/2013

0

Boa tarde pessoal.
Estou tentando enviar uma imagem para o sql server.
Está funcionando para imagens pequenas (25k por exemplo) quando tento enviar uma imagem maior (75k por exemplo) me retorna o erro.

The remote server returned an error: (413) Request Entity Too Large.

segue o meu web.config
<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="ConnectionString" value="Data Source=ONCOPRODSRV046\KRAFTSALES;Initial Catalog=KRAFTSALES;Persist Security Info=True;User ID=myclinic;Password=mycl1n1c@2013"/>
    <add key="ConnectionStringMobile" value="Data Source=ONCOPRODSRV162;Initial Catalog=SARMobile;Persist Security Info=True;User ID=myclinic;Password=myclinic"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IKraftMobileService"
     		              allowCookies="true"
                      maxReceivedMessageSize="2147483647" 
                      maxBufferSize="2147483647"
                      maxBufferPoolSize="2147483647"
                      closeTimeout="00:01:00"
                       openTimeout="00:01:00" receiveTimeout="03:00:00" sendTimeout="01:00:00">
        </binding>
      </basicHttpBinding>
    </bindings>

    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>



segue o app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IKraftMobileService" 		              allowCookies="true"
                      maxReceivedMessageSize="2147483647" 
                      maxBufferSize="2147483647"
                      maxBufferPoolSize="2147483647"/>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://10.0.2.40/KraftMobileService/KraftMobileService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IKraftMobileService"
                contract="KraftMobileServiceReference.IKraftMobileService"
                name="BasicHttpBinding_IKraftMobileService" />
        </client>
    </system.serviceModel>
</configuration>


alguém sabe o que pode ser?
obrigado
Eric Miranda

Eric Miranda

Responder

Posts

14/08/2013

Gabriel Simas

Eric,

Existe um artigo na MSDN que fala justamente sobre o problema que você está enfrentando, dá uma olhada nele neste link [url]http://blogs.msdn.com/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx[/url]

Espero que lhe ajude a resolver o problema.

Caso não funcione, não hesite em nos procurar, estamos a disposição para te ajudar no êxito.

Forte Abraço
Responder

Que tal ter acesso a um e-book gratuito que vai te ajudar muito nesse momento decisivo?

Ver ebook

Recomendado pra quem ainda não iniciou o estudos.

Eu quero
Ver ebook

Recomendado para quem está passando por dificuldades nessa etapa inicial

Eu quero

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar