开发者

WCF upload large images as wsHttpBinding

I've created a WCF Service to upload images. It works fine with images < 50KB or so but I get "The remote server returned an error: (400) Bad Request." with larger images. I've been looking for ages and tried lots of different things, including setting the maxRequestLength and several other settings.

On the client-side of things the web.config is picking it up as a basicHttpBinding and I'm after a wsHttpBinding (for the more up-to-date feature-set). If I manually change the the binding type to wsHttpBinding and change the corresponding options, I get a Unsupported Media Type error. Lookingin the WCF Test Client it shows the service as a basicHttpBinding too.

So my question is two-fold really.

  1. What do I need to do to allow my service to handle files > 50KB?
  2. What do I need to change for my service to be recognised as wsHttp instead of basicHttp?

Apologies if there is a question answering these - I have scoured stackoverflow and tried a few suggestions but it is possible I've missed it!

EDIT: As is always the way, I've managed to solve the wsHttpBinding issue now by fiddling around with the service web.config and manually changing the endpoint to wsHttpBin开发者_运维问答ding. Still getting the large upload filesize issue though.


you will need to update your bindings in you web.config

e.g. this is how i did in my wcf restful service. i believe it will be very similar in your case as well

    <bindings>
          <webHttpBinding>
              <!-- buffer: 64KB; max size: 64MB -->
              <binding name="StreamedBinding" closeTimeout="00:01:00" openTimeout="00:01:00" 
                       receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Streamed" 
                       maxBufferPoolSize="67108864" maxBufferSize="65536" maxReceivedMessageSize="67108864">
              </binding>
          </webHttpBinding>
</bindings>

<service name="WCFRestFul.ApiRestful">
        <endpoint address="" binding="webHttpBinding"
                  bindingConfiguration="StreamedBinding" bindingName="StreamedBinding" 
                  contract="WCFRestFul.IApiRestful" behaviorConfiguration="web" />
 </service>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜