2014-10-20 3 views
0

이 메시지를 중복으로 삭제하지 마십시오 !!원격 서버에서 오류를 반환했습니다 : (413) 요청 엔터티가 너무 큼

XML 파일을 업로드하여 데이터베이스로 가져올 수있는 WCF 서비스를 작성 중입니다. 그러나 위의 오류가 나는 64k 기본값 위에 파일을 업로드 할 때받습니다.

이 문제에 대해 이미 여기에 게시 된 모든 질문을 읽고 구현했지만 여전히 동일한 문제에 직면하고 있습니다.

내 구성 파일 (클라이언트와 서버 모두)의 모든 바인딩 값이 2GB의 최대 크기를 허용하도록 증가했습니다. 여기



    <binding name="BasicHttpBinding_BailiffServices" 
        maxBufferSize="2147483647" 
        maxBufferPoolSize="2147483647" 
        maxReceivedMessageSize="2147483647"> 
       <readerQuotas maxDepth="2147483647" 
          maxStringContentLength="2147483647" 
          maxArrayLength="2147483647" 
          maxBytesPerRead="2147483647" 
          maxNameTableCharCount="2147483647" /> 
       &ltsecurity mode="None" /> 

이러한 바인딩을 사용하는 WCF 서비스이다.



    <services> 
      <service name="ClientService.ClientService"> 
      <endpoint address="http://subversion/BusinessTier.Services.ClientService.svc" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_BailiffServices" 
       name="BasicHttpBinding_IClient" contract="ClientService.IClient" /> 
      </service> 
      <service name="DebtorService.DebtorService"> 
      <endpoint address="http://subversion/BusinessTier.Services.DebtorService.svc" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_BailiffServices" 
       name="BasicHttpBinding_IDebtor" contract="DebtorService.IDebtor" /> 
      </service> 
     </services> 

또한 IIS에서 큰 파일을 처리 할 수 ​​있도록 설정을 구성에 추가했습니다.



    <system.webServer> 
     <modules runAllManagedModulesForAllRequests="true"/> 
     <security> 
      <requestFiltering allowDoubleEscaping="true"> 
      <requestLimits maxAllowedContentLength="2147483647"/> 
      <fileExtensions allowUnlisted="true"/> 
      <verbs allowUnlisted="true"/> 
      </requestFiltering> 
     </security> 
     </system.webServer> 

지금까지 내가 내 WCF 서비스가 큰 파일을 수용 할 수 있도록 필요한 모든 설정을 수정했지만, 그들 중 누구도 지금까지 일하지 않은 볼 수 있습니다.

모든 의견을 크게 기뻐할 것입니다.

+1

예외 호출 스택은 어디에 있습니까? 서버 측 또는 클라이언트 측 예외입니까? –

+0

이것은 서버 측 예외입니다. – DomBurf

+0

필자는 몇 시간 동안 헤드 스크래칭을 해본 결과 결국이 기능을 사용할 수있었습니다. 바인딩 이름 "BasicHttpBinding_BailiffServices £ 요소를 모두 요소와 요소에서 제거했습니다. MSDN 사이트에서이 솔루션을 발견했습니다. 희망이 다른 사람에게 도움이됩니다. – DomBurf

답변

-1

필자는 수 시간 동안 머리를 긁어 낸 후에 결국이 작업을 할 수있었습니다. < 바인딩/> 요소와 < 끝점/> 요소 모두에서 바인딩 이름 "BasicHttpBinding_BailiffServices"를 제거했습니다. MSDN 사이트에서이 솔루션을 발견했습니다. 희망이 다른 사람을 도와줍니다.

+3

바인딩 구성을 제거한 경우 이해가되지 않습니다. 'basicHttpBinding'에 대한 기본 값을 낮추고 있습니다. 솔루션을 제공 한 MSDN 사이트에 연결할 수 있습니까? – Tim

0

'원격 서버가 예기치 않은 응답을 반환했습니다 : (413) 요청 엔터티가 너무 큽니다.'와 같은 오류가 발생하지 않도록 해결책을 찾았습니다. WCF 서비스 구성에서 basicHttpBinding을 사용하는 경우 Web.config에서 최대 메시지 길이를 늘리면 wcf를 통해 큰 바이트 배열을 보내기 위해 서버 web.config 및 클라이언트 app.config 파일을 업데이트 할 수 있습니다.

내가 또한 클라이언트 app.config 파일에 구성을 결합 추가 한

<system.serviceModel> 
<bindings> 
    <basicHttpBinding> 
    <binding maxReceivedMessageSize="2147483647" sendTimeout="00:10:00" receiveTimeout="00:10:00"> 
     <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<behaviors> 
    <serviceBehaviors> 
    <behavior> 
     <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="true"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<protocolMapping> 
    <add binding="basicHttpsBinding" scheme="https" /> 
</protocolMapping> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"> 
    <serviceActivations> 
    <add factory ="WebService.NInjectServiceHostFactory" relativeAddress="TestServic.svc" service="WebService.Services.ServiceManager"/> 
    </serviceActivations> 
</serviceHostingEnvironment> 
의 Web.config

에서 다음 바인딩과 행동의 매개 변수를 포함합니다.

<system.serviceModel> 
<bindings> 
<basicHttpBinding> 
    <binding name="BasicHttpBinding_IServiceManager" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
    <security mode="None"/> 
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> 
    </binding> 
</basicHttpBinding> 
</bindings> 

<client> 
<endpoint address="http://localhost:49359/ServiceManager.svc" 
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPackageManager" 
contract="PackageManager.IPackageManager" name="BasicHttpBinding_IPackageManager" /> 
</client> 

</system.serviceModel> 

이것은 또한 시간 초과 오류도 처리합니다.

관련 문제