在 WCF 和 WCF 之间动态公开服务引用银光
几天来,我一直在用头撞砖墙,试图解决我在使用 WCF 服务和 Silverlight 时遇到的问题。
我的问题是我有 5 个 Silverlight 项目模块,我将它们动态读取到一个主 Silverlight 应用程序中。这些模块中的每一个都有自己的业务层和 DAL,因此它会对其 WCF 服务进行自己的调用,但是当我将模块加载到并尝试运行 WCF 命令时,我收到一条错误消息,指出我的 ServiceReference 不存在,这是因为该服务是模块“ServiceReference.config”的一部分,而不是主项目服务参考的一部分。
我是否可以动态获取 Master Silverlight 项目以获取 ChannelFactory 列表,然后创建通道并读取所有元数据并完全摆脱服务引用?您如何避免使用服务参考?
非常感谢您的所有帮助,我认为我对此感到疯狂。
谢谢
罗比
For days i have been banging my head against a brick wall, trying to work out a problem that i am having with WCF Services and Silverlight.
My problem is that i have 5 Silverlight Project modules that i read dynamically into one Master Silverlight Application. Each one of these modules has their own Business Layer and DAL so it makes its own calls to its WCF Services, yet when I load the modules into and try to run a WCF command i get an error message saying that my ServiceReference does not exist, this is because the Service is part of the Modules "ServiceReference.config" isntead of the Master projects Service Reference.
Is there are away that i can dynamically get the Master Silverlight project to take in a list of ChannelFactory's and then create the channels and read in all the metadata and get rid of the Service Refences totally? How do you get around having to use the Service References?
All of your help is greatfully appreciated, i think im going insane over this one.
Thanks
Robbie
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,你可以这样做。您可以复制生成的文件“Reference.cs”,为此,您必须:
现在您可以复制它并将其作为普通类添加到您的项目中,并删除应用程序的服务引用。对于 ChannelFactory,是的,您可以通过以下代码创建:
Yes you can do that. You can copy the generated file "Reference.cs", to do this, you have to:
Now you can copy this and add to your project as a normal class and remove the service reference of your application. For the ChannelFactory, yes you can create through this code: