WPF 中的 MaxArrayLength 异常
我正在开发一个项目,该项目是一个网站、一个移动应用程序和一个桌面 WPF 应用程序,它们都依赖于服务。移动应用程序工作正常,但桌面和网站在从数据库获取图像时遇到问题,因为 MaxArrayLength 属性。我们能够更改 web.config 文件的 maxArrayLength 属性,并且网站现在可以正常工作,但桌面应用程序仍然无法正常工作。我们知道我们应该更改 App.config 文件中的某些内容,但无法弄清楚 maxArrayLength 属性应该在哪里(它在什么标签下,等等)。
目前,我们可以通过桌面直接参考该服务,也可以通过网站提供服务参考。有没有什么方法可以在不添加服务引用并且能够保留对服务的直接引用的情况下做到这一点?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你为什么要这么做?
如果您直接引用 WCF 项目,仅涉及一些包含的业务逻辑,您的解决方案可能需要进行一些项目重构。也就是说,您应该在单独的项目中拥有供所有客户使用的业务逻辑,以保持高内聚性。
如果您需要调用 WCF 服务来实际访问所提供的服务(而不仅仅是调用公开的业务逻辑,这可能就是您正在做的事情,如果我的理解是正确的),那么您很可能会想要执行任一选项之一:
选项 A
使用服务引用(而不是项目引用)以便通过自动生成的代理调用 WCF 服务。
选项 B
使用工具(带有一些配置)和 IoC 容器来解决对 WCF 服务的依赖关系。请参阅本文,了解有关如何入门的一些线索。此示例使用 Castle 非常简单的 WCF 集成工具。
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.