Silverlight class library calling WCF web service

本文讨论了将WCF服务引用分布在多个Silverlight模块中导致的问题,并提供了解决方案,即将所有服务引用集中到单一类库中,并在主应用中通过链接方式引入配置文件。
Hi,

We have a 3-tiered application with a Silverlight front-end, that queries WCF web services. This worked fine until we moved part of the application to a few Silverlight class libraries, let's say ModuleA, B and C. Those modules contain both standard classes and user controls.

Querying a web service requires a ServiceReferences.ClientConfig file. Instead of one of those in the main application, we now have one in each module. The problem is now that:

  • They are not embedded in the final XAP file anymore
  • Even if they were, we have 3 different files named ServiceReferences.ClientConfig, I see a conflict coming up!



Do you know how to embed those files in the XAP so that the web service calls work? Then, should we group all the web references into another class library that is in turn referenced by everyone, to avoid having 3 files with the same name?

Thanks for your help,

Romain

=============

Well it's me again, I might have solved the problem by:

  • Adding all the service references in one single class library
  • Making all the modules reference this single library
  • Adding a link to the now unique 'ServiceReferences.ClientConfig' file in the main application, like described here: http://silverlight.net/forums/t/34747.aspx


If you don't mind I'll leave this open for a few days if anyone has any better suggestions! Thanks CraigN for your indirect help :)

Romain

 

====================

As a matter of interest, a common problem with putting the WCF client code in an assembly is that at runtime the ServiceReference.config file is not available to the application. To solve this, add the file to the Silverlight application project as a link.

 

 

 

 

 

转载于:https://www.cnblogs.com/wmt1708/archive/2009/02/17/1392410.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值