控制台中的WCF Ria类库

时间:2014-08-26 21:26:00

标签: wcf-ria-services

我有一个在Web项目中引用的WCF Ria类库(使用EF)。然后一个silverlight应用程序链接到Web项目,这非常有效。

现在我正在尝试在控制台应用程序中重用WCF Ria类库。我从控制台添加了对WCF ria类库的引用并尝试执行操作。但没有任何事情发生。

我做错了吗? WCF RIA应该只使用Silverlight客户端吗?

1 个答案:

答案 0 :(得分:0)

最后我明白了。我们可以使用SOAP端点公开WCF ria。 为此,

第1步

  • 在我们的应用程序的web.config文件中进行更改 主持ria服务。

  

...............
<sectionGroup name="system.serviceModel">
  <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" allowDefinition="MachineToApplication" requirePermission="false" />
</sectionGroup>

  ....................

<system.serviceModel>
   <domainServices>
     <endpoints>
       <add name="soap"
            type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, 
                  Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, 
                  Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
       ...
     </endpoints>
   </domainServices>
   ...
 </system.serviceModel>

........

Step2 - 添加对dll的引用

Microsoft.ServiceModel.DomainServices.Hosting on the wcf ria services.This dll is a part of WCF RIA Services toolkit

现在该服务已准备就绪。通常,该服务将具有这样的URL http:// nameofyourserver:port / ClientBin / NameOfYourSolution-Web-NameOfYourDomainService.svc

步骤3 - 在客户端添加服务引用,就像任何其他WCF服务一样。

有关如何使用非Silverlight应用程序中通过SOAP公开的WCF RIA的更多详细信息,请访问http://blogs.msdn.com/b/brada/archive/2010/03/29/silverlight-4-ria-services-ready-for-business-exposing-wcf-wsdl-services.aspx