为什么有人会在 Silverlight 中使用 WCF basicHttp Webservice 而不是 WCF RIA 服务?
所以,我已经使用 WCF Ria 服务几个月了,我想知道为什么有人会使用 WCF basicHttp Webservice 而不是使用 WCF RIA 服务?
有人告诉我 RIA 服务不适合企业级应用程序,我想知道为什么?
如果没有 RIA,您似乎必须在客户端和服务器这两个区域编写验证逻辑。此外,RIA 相当容易地处理角色和成员资格。
如果你想使用WCF basicHttp webservice,需要做多少额外的工作?使用 RIA 有什么好处?以及.. 有没有人有使用 wcf basicHttp Web 服务的企业级 silverlight 应用程序的任何好示例?
谢谢!
So, I've been using WCF Ria services for a few months now and I am wondering why would anyone use WCF basicHttp webservice over using WCF RIA Services?
Someone told me that RIA Services is not good for Enterprise Level Applications and I am wondering why?
W/out RIA it seems you have to write validation logic in 2 areas, client and server. Also, RIA handles roles and membership fairly easily.
How much extra work is involved if you want to use WCF basicHttp webservice? What is the benifit over using RIA? and.. Does anyone have any good examples of an enterprise level silverlight application using wcf basicHttp webservice?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Silverlight 中 WCF 支持的问题与 Silverlight 插件中嵌入的 .NET Framework 的有限子集有关,因为它本质上是 .NET Framework 的缩减版本。由于 Silverlight 插件中 .NET 运行时的规模缩小,它无法像标准 .NET 项目那样对 WCF 提供完全支持。这样做是为了从客户的角度加快 SL 的初始下载速度,并加快 SL 产品的上市时间。请记住,SL 插件不依赖于正在安装的现有 .NET 框架,这就是市场上有 Linux、Windows Phone 7 和 OS X 版本的原因。
随着时间的推移,他们继续添加按需功能。例如,Silverlight 5 将支持 WS-Trust(请参阅 此处了解 5) 中新功能的完整列表。
我建议您阅读此资源,了解尝试从客户端调用 WCF 服务时可能会错过什么:
http://msdn.microsoft.com/en-us/library/cc896571(v=vs.95).aspx
请记住,您可以轻松代理通过 RIA 服务端点调用更复杂的 WCF 服务,这些端点实际上直接从服务器端调用服务。
至于使用标准 WCF 而不是 RIA……当您的中间层具有多种客户端类型时,这是有优势的,尽管使用 RIA,您可以简单地将端点公开为 SOAP 1.1 端点,并要求人们使用该范例而不是 WCF 进行连接。您不必使用 RIA 或什么都不用;您可以根据您的需要进行混合搭配以满足您的要求。就我个人而言,如果可能的话,我热衷于使用 RIA。
The issues with WCF support in Silverlight relates to the limited subset of the .NET Framework embedded in the Silverlight plug-in as it's essentially a scaled down version of the .NET Framework. As a result of the scaled down .NET runtime in the Silverlight plug-in, it does not have the same full support for WCF that you get from standard .NET projects. This was done to make the initial download of SL quick from a client perspective and increase time-to-market of SL as a product. Keep in mind that the SL plug-in has no dependency on an existing .NET framework being installed which is why Linux, Windows Phone 7, and OS X versions are on the market.
As time has progressed they continue to add in-demand features in. For example, Silverlight 5 will support WS-Trust (see here for a complete list of new features in 5).
I recommend you read this resource to see what you may miss out on by trying to call WCF Services from the client:
http://msdn.microsoft.com/en-us/library/cc896571(v=vs.95).aspx
Keep in mind you could very easily proxy out calls to more complex WCF services through RIA Services endpoints which are in effect calling the service directly from server-side.
As for using standard WCF instead of RIA ... there are advantages when your middle tier has multiple client types, though with RIA you could simply expose your endpoints out as SOAP 1.1 endpoints and require people to connect using that paradigm instead of WCF. You do not have to use RIA or nothing; you could mix and match to meet your requirements as you see fit. Personally I am big on just using RIA if at all possible.
可以公平地说,RIA Services 经历了成长的阵痛。我遇到的一些最大的问题(例如无法从 Invoke 方法返回非实体的复杂对象,以及缺乏对以 MVVM 方式使用的适当支持)大部分已在 RIA Services SP1 中得到修复。我认识的一些在大型企业应用程序中使用它的人对此感到非常头疼(至少在早期)。我不太确定现在这方面的情况如何,他们的具体问题是否已经得到解决。
也就是说,我个人认为这是一项很棒的技术。它使标准 WCF 服务中令人痛苦的任务变得容易(我最喜欢的是能够在客户端上对返回 IQueryable 的域服务中的方法指定查询,这些方法在服务器上执行 - 使排序/过滤/分组/分页变得轻而易举) 。它是否适合您取决于您的场景。它的设计主要是为了使对实体执行 CRUD 操作变得容易,所以如果这主要是您所需要的,那么它就是完美的。然而,RIA 服务被设计为仅由 Silverlight 应用程序使用(至少目前如此)。您可以从其他客户端访问它们,但您无法获得使它们如此出色的所有功能。因此,如果您需要支持其他客户端平台,它可能不适合。
我认为 RIA 服务很棒,但最终取决于您的场景,它们是否适合您的项目。作为一种技术,它是针对特定场景的,并不是为了解决世界上所有的软件开发问题。一些可能抱怨它的人可能没有按照预期的方式使用它,并突破了它的极限(也就是说,它也不完美,并且存在问题)。如果您可以提供更多详细信息(例如应用程序的规模、需要支持的客户端平台以及项目的开发人员数量),我可能会给您一些更有帮助的建议。
希望这有帮助......
克里斯
It's fair to say RIA Services has had its growing pains. Some of my biggest bugbears with it (such as not having the ability to return complex objects that aren't entities from Invoke methods, and the lack of decent support for being used in an MVVM way) have mostly been fixed in RIA Services SP1. Some people I know using it in huge enterprise applications have had major headaches with it (at least in the early days). I'm not quite sure where things stand now in that respect, as to whether their particular problems have been resolved yet.
That said, I personally think it's a fantastic technology. It makes tasks that are painful with standard WCF services easy (my favourite is being able to specify queries on the client on methods in your domain service that return IQueryable, that execute on the server - making sorting/filtering/grouping/paging a breeze). Whether it's right for you depends on your scenario. It's designed primarily to make performing CRUD operations on entities easy, so if that's primarily what you need then its perfect. RIA Services is designed to be consumed by Silverlight application only however (at least for the moment). You can access them from other clients, but you don't get all the features that makes them so good. So if you need to support other client platforms, it may not be the right fit.
I think RIA Services is awesome, but ultimately it depends on your scenario as to whether they are right for your project. As a technology, it's geared towards particular scenarios, and isn't intended to solve all the world's software development problems. Some people who might complain about it possibly aren't using it in the way it was intended, and pushing its limits (that said, it isn't perfect either, and has had its issues). If you can possibly provide some more details (such as the scale of the application, the client platforms it needs to support, and the number of developers on the project), I'd probably be able to give you some more helpful advice.
Hope this helps...
Chris