简体   繁体   中英

WCF restful web services | send image

I have to send 2 images to my web services which will add them in a Word document.

For the moment, I send the images as base64 .

When I send only 1 image, there is no problem but when I send 2 images (maximum I can send), chrome is crashing. ( "ow snap, ..." ).

It crashed when I tried to send 2 x 762 KB images. When trying with 1KB images, it works.

Should I send bytes array instead of base 64 ? Or any other way ?

I have already changed my web.config to allow to send more data.

WEB CONFIG

<binding name="WebHttpEndpointBinding" transferMode="StreamedRequest" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">

EDIT

I tried to add this in the web config but still not working.

<security>
     <requestFiltering>
          <requestLimits maxAllowedContentLength="2000000000" />
     </requestFiltering>
</security>

In config file you have to increased the size to upload large data as following:

 <webHttpBinding> <binding name="web" maxReceiveMessagesize="250000000" maxBufferSize="250000000" maxBufferPoolSize="250000000" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeOut="00:10:00"> <readerQuotas maxDepth="250000000" maxStringContentLeangth="250000000" maxArraylength="250000000" maxBytesPerread="250000000" maxNameTableCharCount="250000000"/> <security mode="None" /> </binding> </webHttpBinding> 

Please do check that you have already used the binding configure in the endpoint as following:

 But it still can not help. Please try to check that you have already used the binding configure in the endpoint as following: <endpoint address="http://" binding="webHttpBinding" bindingConfiguration="web" contract="..." name="..." /> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM