FAQ and Solutions

Source: Internet
Author: User

1. Use the solution with httpcontext. Current empty on the WCF Server:

1) Add the description [aspnetcompatibilityrequirements (requirementsmode = aspnetcompatibilityrequirementsmode. Allowed)] to the server-side WCF class.

2) Add <servicehostingenvironment aspnetcompatibilityenabled = "true"/> to the <system. servicemodel> node of webconfig on the server.

2. Use httpcontext. Current. server. mappath as an alternative solution on the WCF Server:

System. Web. Hosting. hostingenvironment. mappath ("~ /Upload "+ filefolder );

3. Solve the Problem of large file byte [] transmission:

In the server and web. config files, the bindings section is empty, and the service does not specify the bindingconfiguration attribute. Therefore, they use the default 65535 size.

It is easier to locate the problem:

Add a new binding setting (in the system. servicemodel node) in the bindings section to specify the maximum accept data:

<  Bindings  > <  Basichttpbinding  > <  Binding  Name  = " Largedata " Maxcompute edmessagesize  = " 2147483647 " Messageencoding  = " Text "
Transfermode = " Streamed " Sendtimeout = " 00:10:00 " /> </ Basichttpbinding > </ Bindings >

Then, specify the bindingconfiguration attribute for the corresponding service:

 <  Service  Behaviorconfiguration = " Server. Service. wcfservicebehavior " Name  = " Server. Service. wcfservice " > <  Endpoint  Address  = "" Binding  = " Basichttpbinding " Bindingconfiguration  = " Largedata "
Contract = " Server. Service. wcfservice " /> < Endpoint Address = " MEX " Binding = " Mexico httpbinding " Contract = " Imetadataexchange "/> </ Service >

In this way, you can send large enough data from the client.

P.s .:

. By default, only files of 4 MB can be uploaded. Therefore, although the configuration at both ends of the WCF is set, the file cannot be uploaded.. add

 
<Httpruntimemaxrequestlength="102400"/>

The unit here is kb, so that MB of files can be uploaded. Of course, it is better to perform multipart transmission for such a large file.

4. solutions with the following errors:

① The message cannot be processed. This is probably because the "messages" operation.

Solution: Modify the following nodes in the binding node of the client and server:< Security Mode = "None"> </Security>

② Timeout

Solution: The sendtimeout = "00:05:00" in the <binding name = "wshttpbinding_iservice" node of the client is the timeout time. Just adjust it.

 

 

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.