클라이언트

주의할점은

서버와 클라이언트 방식을 똑같이 맞추어 줘야한다

일단 기본적으로 20MB 이상 안올라감

아래값은 최대값이다(2GB) 이렇게 하면 성능 저하 및 디도스 공격에 취약해짐. 적절하게 값을 지정 해야하고

인증받은 계정만 쓸 수 있게 해야함

 

   transferMode="Streamed" messageEncoding="Mtom"

 

        private static IFileService CreateIFileService()
        {
            BasicHttpBindingService<IFileService> service
                                = new BasicHttpBindingService<IFileService>(Framework.Module.WCFCommon.FileServiceURL);
            service.BasicHttpBindingProperty.MessageEncoding = WSMessageEncoding.Mtom;
            service.BasicHttpBindingProperty.TransferMode = TransferMode.Streamed;
            service.BasicHttpBindingProperty.MaxBufferPoolSize = 2147483647;
            service.BasicHttpBindingProperty.MaxBufferSize = 2147483647;
            service.BasicHttpBindingProperty.MaxReceivedMessageSize = 2147483647;
      
            service.BasicHttpBindingProperty.ReaderQuotas.MaxDepth = 2147483647;
            service.BasicHttpBindingProperty.ReaderQuotas.MaxArrayLength = 2147483647;
            service.BasicHttpBindingProperty.ReaderQuotas.MaxBytesPerRead = 2147483647;
            service.BasicHttpBindingProperty.ReaderQuotas.MaxStringContentLength = 2147483647;
            service.BasicHttpBindingProperty.ReaderQuotas.MaxNameTableCharCount = 2147483647;

            return service.CreateProxy();
        }

서버 web.config

    <bindings>
      <basicHttpBinding>
        <binding name="baseBasicHttpBinding" closeTimeout="00:10:00"
          openTimeout="00:50:00" receiveTimeout="01:50:00" sendTimeout="00:50:00"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
          transferMode="Streamed" messageEncoding="Mtom">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
 <services>
      <service name="KAI.CIM.WebService.FileService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="baseBasicHttpBinding"
          contract="KAI.CIM.Framework.Contract.IFileService" />
        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
          contract="IMetadataExchange" />
      </service>
    </services>

 

http://msdn.microsoft.com/ko-kr/library/aa395209(v=vs.110).aspx

* MTOM은 SOAP 메시지와 함께 큰 이진 첨부 파일을 원시 바이트로 전송함으로써 더 작은 크기의 메시지를 허용하는 메커니즘입니다.

+ Recent posts