Silverlight中的普通WCF [英] Normal WCF in Silverlight

查看:59
本文介绍了Silverlight中的普通WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好专家,我是Silverlight的新手,甚至在WCF中也不是很老。但是我在为Silverlight创建普通WCF和WCF时看到了不同。按照以下步骤创建普通WCF时:

右键单击解决方案资源管理器中的Web项目在visual c#WCF服务下添加新项目

它创建三个文件对我来说Iservice(接口)这个的service.svc和service.svc.cs都很好。直到这里。

我理解所有这三个文件的工作。并使用它们甚至通过更改weconfig文件并添加此行
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

我能够使我的WCF也适用于silverlight。

但如果我遵循愚蠢的步骤

右键单击解决方案资源管理器中的Web项目在visual c#silverlight选项卡下添加新项目使用支持Silverlight的WCF服务。
<然后没有创建Iservice文件,而是在service.svc.cs文件中定义了操作契约。

现在我的困惑是使用WCF服务用于Silverlight的方式以及为什么将是另一个的好处和缺点。

Hello Experts,
I am a newbie to silverlight and even not much older in WCF. But I have seen a difference while creating a normal WCF and a WCF for silverlight. When I create a normal WCF by following these steps:

Right click the web project in solution explorer  add new item under visual c# WCF service.

It creates three files for me an Iservice (interface) the service.svc and service.svc.cs of this all is fine till here.

I understand the working of all these three files. And use them even by changing the weconfig file and adding this line
  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

I am able to make my WCF work for silverlight too.

But if I follow the foolowing steps

Right click the web project in solution explorer  add new item under visual c# silverlight tab use Silverlight-enabled WCF service.

Then the Iservice file is not created instead the operation contracts are defined in the service.svc.cs file.

Now my confusion is which way to use the WCF service for the silverlight and why what will be the benefits and the drawbacks of the one over the other.

推荐答案

Silverlight中的WCF总是有一个domine问题你将有拥有客户端访问策略xml并指定客户端。
如果您添加了启用服务的服务,那些客户可以在sl3中使用您的应用程序.1。添加所需的Dlls

WCF in silverlight always have a domine problem
u 'll have to have the client access policy xml and specify the client.
Those clients can use your application
in sl3 if your add a sl enabled service
 1. It adds the required Dlls

2。它添加了一个svc和一个cs文件。

在cs文件中你可以添加服务功能
从现在开始没有Iservice类了你可以直接添加服务功能service.cs中的服务合同属性

用法取决于要求。

2. It adds a svc and a cs file.

In the cs file you can add the service function
There is no Iservice class from now
U can add the service fuction directly add service contract attribute in service.cs

Usage depends on the requirement.


这篇关于Silverlight中的普通WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆