Silverlight call WCF common error Silverlight WCF upload Big Data

Source: Internet
Author: User

 

Error 1

Error Description: the remote server returned an error: notfound

Possible cause: the WCF Service limits the number of data packets to a maximum of 65535. Silverlight sends large data packets to the server (the sample slices are directly stored in the database), and WCF returns the preceding error.

During transmission, it is best to use list <string> instead of string as the parameter.

Solution:

(1) modify the servicereferences. clientconfig file on the Silverlight end to increase the buffer size.
< Bindings >  
< Basichttpbinding >  
< Binding Name = "Basichttpbinding_idataservice"  
Maxbuffersize = "2147483647"  
Maxcompute edmessagesize = "2147483647" >  
< Security Mode = "NONE" />  
</ Binding >  
</ Basichttpbinding >  
</ Bindings >

 

System. servicemodel. basichttpbinding binding = new system. servicemodel. basichttpbinding (system. servicemodel. basichttpsecuritymode. None );
Binding. maxcompute edmessagesize = int. maxvalue;
Binding. maxbuffersize = int. maxvalue;
Binding. receivetimeout = timespan. fromminutes (5 );
Binding. sendtimeout = timespan. fromminutes (5 );
Binding. closetimeout = timespan. fromminutes (5 );
Binding. opentimeout = timespan. fromminutes (5 );
Endpointaddress Ep = new endpointaddress ("../dataservice. SVC ");
Mytest. dataservice. dataserviceclient client = new dataserviceclient (binding, EP );

(2) modify the server and add the custom basichttpbinding object to Web. config,

 

Server: Web. config

<Configuration>
<Deleetask>
<Add key = "returntablepath" value = "C: \ testdata \ test_data.csv"/>
</Appsettings>
<System. Web>
<Httpruntime maxrequestlength = "2147483647"/>
<Compilation DEBUG = "true" targetframework = "4.0"/>
</System. Web>

<System. servicemodel>
<Servicehostingenvironment multiplesitebindingsenabled = "true"/>
<Behaviors>
<Servicebehaviors>
<Behavior name = "mappingdataeditor. Web. dataservicebehavior">
<Servicemetadata httpgetenabled = "true"/>
<Servicedebug includeexceptiondetailinfaults = "false"/>
<Datacontractserializer maxitemsinobjectgraph = "2147483647"/>
</Behavior>
</Servicebehaviors>
</Behaviors>
<Services>
<Service behaviorconfiguration = "mappingdataeditor. Web. dataservicebehavior" name = "mappingdataeditor. Web. dataservice">
<! -- Name = namespace (excelserver) + class name (server1) -->
<Endpoint address = "" bindingconfiguration = "largebuffer" binding = "basichttpbinding" Contract = "mappingdataeditor. Web. idataservice"/>
<! -- Contract = namespace (excelserver) + Interface (iserver1) -->
</Service>
</Services>
<Bindings>
<Basichttpbinding>
<Binding name = "largebuffer" maxbuffersize = "2147483647" maxcompute edmessagesize = "2147483647">
<! -- Name = random name -->
<Readerquotas maxstringcontentlength = "2147483647" maxarraylength = "2147483647"/>
<Security mode = "NONE"> </Security>
</Binding>
</Basichttpbinding>
</Bindings>
</System. servicemodel>
<System. webserver>
<Modules runallmanagedmodulesforallrequests = "true"/>
</System. webserver>
</Configuration>

Error 2

 

Silverlight WCF uploads Big Data

 

1. Server:

Maxrequestlength: Maximum request size (in kilobytes ). The default size is 4096 KB (4 MB ).

< System. Web >
< Httpruntime Maxrequestlength = "2147483647" />
< Compilation Debug = "True" Targetframework = "4.0"   />
</ System. Web >

 

 

< System. servicemodel >
< Bindings >
< Basichttpbinding >
< Binding Name = "Newbinding2mb" Maxcompute edmessagesize = "2147483647"
Maxbuffersize = "2147483647" Maxbufferpoolsize = "2147483647"
Closetimeout = "10:00:00" Opentimeout = "10:00:00" Receivetimeout = "10:00:00"
Sendtimeout = "10:00:00"   >
< Readerquotas Maxarraylength = "2147483647" Maxstringcontentlength = "2147483647"
Maxbytesperread = "2147483647" Maxdepth = "2147483647" Maxnametablecharcount = "2147483647"   />
</ Binding >
</ Basichttpbinding >
</ Bindings >

 

 

2. Client

< Binding Name = "" Maxbuffersize = "2147483647" Maxcompute edmessagesize = "2147483647" >
< Security Mode = "NONE"   />
</ Binding >

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.