This example says WCF configuration, MVC and WPF are not explained!
Effect:
Demo Hierarchy:
MVC client:
Connect the WCF service, convert the picture to stream, and then upload the stream in a byte[] way!
Core code
WCF Service side:
With IIS as the host, the HTTP protocol implements the receiving client's byte[] data, which is returned to the WPF client!
Server Web. config configuration is very important, in order to achieve large image data transfer, you need to add to the binding
<binding name= "imageoperationservice_binding" maxbufferpoolsize= "2147483647" maxbuffersize= "2147483647" Maxreceivedmessagesize= "2147483647" >
<readerquotas maxdepth= "2147483647" maxstringcontentlength= "2147483647" maxarraylength= "2147483647" Maxbytesperread= "2147483647" maxnametablecharcount= "2147483647"/>
Add under the system.web node
<system.web>
<compilation debug= "true"/>
</system.web>
The client also needs to configure the same information
---------------------------------------------------------------------The following is the service-side configuration code------------------------------------------ ---------------------------
<?xml version= "1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name= "Imageoperationservice_behavior" >
<servicemetadata httpgetenabled= "true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name= "imageoperationservice_binding" maxbufferpoolsize= "2147483647" maxbuffersize= "2147483647" Maxreceivedmessagesize= "2147483647" >
<readerquotas maxdepth= "2147483647" maxstringcontentlength= "2147483647" maxarraylength= "2147483647" Maxbytesperread= "2147483647" maxnametablecharcount= "2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorconfiguration= "Imageoperationservice_behavior" name= "LshDemo.Service.ImageOperationService" >
<endpoint address= "Http://192.168.1.75/ImageOperationService.svc" binding= "BasicHttpBinding" bindingconfiguration= "imageoperationservice_binding" contract= "LshDemo.Service.IImageOperationService"/>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation debug= "true"/>
</system.web>
</configuration>
WPF client:
The boot thread listens to the WCF service picture information, reads the WCF service byte stream in time, displays in the interface!
Core code:
Demo download link: http://yunpan.cn/cfpygtIvCqjUv;
Extract Code b289
WPF+MVC+WCF big picture Upload echo Demo