Share WCF RIA Services Library between Silverlight Applications

半腔热情 提交于 2019-12-24 07:22:04

问题


I have: - some count of Silverlight Web applications, hosted on different IIS virtual directories. One Application has WCF RIA Services, which part of functionality I want to share between all these SL applications How to do this? I have idea to create WCF RIA service library, which referenced to WCF RIA Services host and have needed functionality to clients. But If I will create references to this DLL from my different solutions, how this DLL (WCF RIA Services Library) known, where address (endpoint) of this WCF host?

For example, WCF RIA is hosted on http:\webapps\UserManager and SL aplpication is hosted on http:\webapps\ClientApp


回答1:


There is no spoon... and there are no fully-qualified Endpoints with RIA services by default...

When you link the .web RIA class library projects to your main web project, the services are accessed behind the scenes by URLs like:

http://localhost:2911/ClientBin/RiaServices-Documents-Web-DocumentDomainService.svc/binary/GetDocuments?$take=20&$includeTotalCount=True

The client RIA class library projects just assume a relative URL (relative to the hosting project), so they will work in any Silverlight application.

To use a RIA service from another location, other than the hosting website, you need to specify the service Endpoint manually in the DomainContext constructor:

DocumentDomainContext d = new DocumentDomainContext("http:someotherserver:1234//ClientBin/RiaServices-Documents-Web-DocumentDomainService.svc");

(I do not know how to do this for a Domain Data Source).



来源:https://stackoverflow.com/questions/6530729/share-wcf-ria-services-library-between-silverlight-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!