-1
현재 WCF 서비스에 파일을 업로드하고 다운로드하는 솔루션을 개발 중입니다. 클라이언트는 ClientBase를 상속하는 클래스입니다. StackOverflow 및 기타 위치에서 스트리밍 및 링크에 MSDN article을 읽었지 만 메시지 크기가 너무 작아서 왜 여전히 메시지를 받는지 알 수 없습니다. 나는 지금까지 작은 파일들로 솔루션을 테스트했으며 작동한다.ClientBase에서 WCF 서비스로 파일 업로드 <T>
서비스는 IIS에서 호스팅되는 7.5
다음은 클라이언트 응용 프로그램에서의 App.config있어 여기
<system.web>
<httpRuntime maxRequestLength="67108864" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding messageEncoding="Mtom" transferMode="Streamed" name="LargeFileStreamingHttpBinding"
maxBufferSize="65536"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/UpdateService.svc"
binding="basicHttpBinding"
contract="IUpdateService"
name="updateServiceEndpoint"/>
</client>
</system.serviceModel>
서버의 관련 부분은 내가 ',
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="UpdateService" behaviorConfiguration="UpdateServiceBehavior">
<endpoint binding="basicHttpBinding" bindingName="LargeFileStreamingWebHttpBinding" contract="IUpdateService"></endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="UpdateServiceBehavior" >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding messageEncoding="Mtom" transferMode="Streamed" name="LargeFileStreamingWebHttpBinding"
maxBufferSize="65536"
maxReceivedMessageSize="2147483647"
/>
</basicHttpBinding>
</bindings>
</system.serviceModel>
또한 있습니다 서버 및 클라이언트 구성에서 다음을 추가했습니다.
<system.web>
<httpRuntime maxRequestLength="2147483647" />
</system.web>
이 내가 잘못 갈 수있는 곳
public class UpdateClient : ClientBase<IUpdateService>, IUpdateService
{
public UpdateClient() : base("updateServiceEndpoint") {}
}
그래서 어떤 아이디어를 가지고 클라이언트를 인스턴스화하고있어 어떻게? 어떤 도움을 주셔서 감사합니다.
- 고마워요!
는 서비스 클래스의 이름을 그냥 "UpdateService을"입니다 bindingConfiguration 속성이 누락되었다거나 어떤 네임 스페이스에 속하지 않는? 후자의 경우 구성을 선택하기 위해''에 완전한 이름을 지정해야합니다. –
carlosfigueira
간결하게하기 위해 서비스 계약 네임 스페이스를 생략했습니다. – abjbhat
이 특정 실수를 저지른 사람이 누구도이 질문을 검색하여 답변을 찾을 수 없으므로 너무 현지화 된 것으로 투표했습니다. –