비슷한 질문이 생겨나 고 그들 모두를 보았습니다. 아무도 내 문제를 해결하지 못하는 것 같습니다.WCF 서비스를 통한 대용량 파일
- UPDATE : - 나는 WCF 서비스를 사용하여 데이터베이스에 대한 문서 (PDF, 문서, 또는 무엇이든)을 업로드하려고
.
여기using (var cw = new WCFClientWrapper<ICommonService>())
{
cw.Channel.DocumentInsert(content, filename, contentType);
}
가 계약에 서명한다 :이 무엇입니까
[OperationContract]
void DocumentInsert(byte[] content, string fileName, string contentType);
나는 콘텐츠를 바이트의 배열을 전달하고 있습니다로 서비스에 대한 호출은 다음과 같습니다 DB에 물건을 저장하기 위해 전달해야합니다.
- 업데이트의 끝 -
내가 성공적으로 작은 파일 (몇 킬로바이트)를 업로드 할 수 있습니다. 내가 큰 일 (20킬로바이트)을 업로드하려고 할 때 그러나, 나는 예외를 얻을 : 'DocumentInsert'작업 에 대한 요청 메시지의 본문을 직렬화 복원에 오류 : 메시지를 역 직렬화하는 동안 포맷터는 예외가 발생했습니다
. 최대 배열 길이 할당량 (16384)은 XML 데이터를 읽는 동안 을 초과했습니다. XML 판독기를 만들 때 사용되는 XmlDictionaryReaderQuotas 개체의 MaxArrayLength 속성을 변경하면이 할당량이 만큼 증가 할 수 있습니다. 줄 1, 위치 31774.
오류가 분명해 보이는군요 ... MaxArrayLength를 늘리십시오. 나는 성공적인 결과없이 그것을했다. 다음은 내 web.configs에서 관련 부분은
클라이언트 :
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="SecureBehavior">
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="WSHttpBinding_Service" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="262144" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="5242880" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://dev.svc.someurl.com/CommonService.svc"
binding="basicHttpBinding"
bindingConfiguration="WSHttpBinding_Service"
behaviorConfiguration="SecureBehavior"
contract="MyApp.Contracts.ServiceContracts.ICommonService"
name="MyApp.Contracts.ServiceContracts.ICommonService">
</endpoint>
</client>
</system.serviceModel>
서비스 :
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="MyBasicHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyApp.WCFServices.CommonService">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="MyBasicHttpBinding"
contract="MyApp.Contracts.ServiceContracts.ICommonService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
<service name="MyApp.WCFServices.AccountService">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="MyBasicHttpBinding"
contract="MyApp.Contracts.ServiceContracts.IAccountService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
부착 진단을 보여줍니다
- 구축 서비스 : 오류없이/경고를 열고 서비스
- : 경고 - 구성 평가 컨텍스트를 찾을 수 없습니다 - 일치하는 태그를 찾을 수 없습니다. 기본 엔드 포인트가 추가되었습니다. 없음 에러/경고
- 메시지를 처리 한 : 없음 에러/경고
- 처리 액션 '
- '는 http://dev.svc.someurl.com/CommonService.svc '으로 청취 http://tempuri.org/ICommonService/DocumentInsert '를 클릭하십시오. : 내가 처음에 쓴 예외를 던졌습니다.
도움을 주시면 감사하겠습니다.
제안 해 주셔서 감사합니다. 그래도 도움이되지 않았다. 내 바인딩을 무시하고 기본 바인딩을 사용합니다. 왜 또는 어떻게하는지 잘 모르겠습니다. – Dmitry