同时拥有 DomianService 和支持 Silverlight 的 WCF 服务是否合理

发布于 2024-09-26 02:37:30 字数 232 浏览 0 评论 0原文

目前,RIA 域服务类似乎无法返回单一自定义类型。

我的应用程序的某些部分仅需要此功能,因此认为获得此功能的唯一方法是回调到简单的启用 silverlight 的 WCF 服务,我相信返回自定义类型不会有问题。我没有看到 Silverlight 客户端应用程序在哪里有任何对 Ria 服务的引用。如何在 silverlight 客户端上设置 Ria 服务和 WCF 服务。 WCF 服务是否会“意识到”RIA 服务已经到位的身份验证?

At the moment it seems that a RIA Domain Services class can not return a sinlge custom type.

There are parts of my app that needs just that, so think the only way to get that is to call back to a simple silverlight-enabled WCF Service, which i beleive will not have a problem returning a custom type. I don't see where the Silverlight client app has any sort of reference to the Ria Services. How do I set up both a Ria services and WCF service on the silverlight client. Will the WCF service be "aware" of the authenication already in place with the RIA services?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无远思近则忧 2024-10-03 02:37:30

这是 RIA 服务中我最大的烦恼之一:)。好处是,他们正在支持从调用方法返回复杂类型(根据 RIA 服务的用户语音站点)。然而,这现在对你没有帮助:)。

实现返回复杂对象的要求的最佳方法确实是设置一个标准 WCF 服务以在需要时返回复杂类型。您可以按照在任何 Web 项目中公开 WCF 的正常方式来执行此操作。然后,您可以在 Silverlight 应用程序中使用它,就像在任何其他类型的项目中使用 WCF 服务一样(通过将其添加为服务引用)。使用它时的主要区别(与其他类型的项目相比)是 Silverlight 仅支持异步调用。与 RIA 服务需要注意的一个区别是,虽然 RIA 服务自动确定域服务的 URI(基于 XAP 文件的来源),但您需要自己处理这一方面(当您尝试部署自己的服务时非常重要)应用 :)。通过在 app.config 文件中设置 URI 来执行此操作,或者使用我在本文随附的代码中使用的方法:http://www.silverlightshow.net/items/Building-a-Framework-for-Silverlight-Line-Of-Business-Applications .aspx

关于您的最后一个问题,是的,RIA 服务使用标准 ASP.NET 身份验证,因此它用于维护身份验证状态的 cookie 也由同一项目中的任何 WCF 服务使用。如果您想了解更多信息,我将在本文中讨论一下 WCF 服务的安全性:http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx

希望这有帮助......

克里斯

This is one of my biggest bugbears of RIA Services :). The good thing is that they are in the process of enabling complex types to be returned from invoke methods (according to the user voice site for RIA Services). However, that won't help you now :).

The best way to implement your requirement to return complex objects is indeed to set up a standard WCF Service to return complex types when required. You do so in the normal way that you would expose a WCF in any web project. You then consume it in your Silverlight application in much the same way you would a WCF Service in any other type of project (by adding it as a service reference). The main difference when consuming it (compared to other types of projects) is that Silverlight only supports asynchronous calls. One difference to be aware of from RIA Services is that whereas RIA Services automatically determines the URI of the domain services (based upon where the XAP file originated from), you will need to handle that aspect yourself (very important when you try to deploy your application :). Do this either by setting the URI in the app.config file, or use the method I use in the code accompanying this article here: http://www.silverlightshow.net/items/Building-a-Framework-for-Silverlight-Line-Of-Business-Applications.aspx.

In regards to your final question, yes, RIA Services uses standard ASP.NET authentication, so the cookie that it uses to maintain your authentication status is also used by any WCF Services in the same project. I talk a bit about security with WCF Services in this article if you want more information: http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx.

Hope this helps...

Chris

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文