简体   繁体   中英

MaxArrayLength Exception in WPF

I am working on a project that is a website, a mobile app, and a desktop WPF app that all depend on a service. The mobile app works fine, but the desktop and website was having a problem with getting images from the database because of a MaxArrayLength property. We were able to change the web.config file's maxArrayLength property and the website now works, but the desktop application is still broken. We know we should change something in the App.config file, but can't figure out where the maxArrayLength property should be (what tag it's under, etc).

We currently have a direct reference through the desktop to the service, and a service reference through the website. Is there any way to do this without adding a service reference and just being able to keep the direct reference to the service?

Is there any way to do this without adding a service reference and just being able to keep the direct reference to the service?

Why would you want to do that?

If you are referencing the WCF project directly, only hitting some included business logic, your solution might need some project refactoring. Ie., you should have business logic that is used by all your clients in a separate project in order to keep cohesion high.

If you need to call the WCF services to actually access the provided services (and not only call exposed business logic, which might be what you are doing, if my understanding is correct ), then you will most likely want to do one of either options:

Option A

Use a service reference (and not a project reference) in order to call the WCF services via an auto-generated proxy.

Option B

Use a facility (with some configuration) and an IoC container to resolve dependencies on your WCF services. See this article for some clues on how to get started. This example uses Castle's very simple WCF Integration Facility .

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