zoukankan      html  css  js  c++  java
  • WPF,WinForm调用WCF RIA

    由于公司要开发WinForm,WPF,SL版的搜索引擎,这是需要把搜索代码和service层和具体的项目decouple. 

    MODEL+DomainService <---->Query <------>WPF,WinForm;MODEL+DomainService <---->SL.

    Query引用DomainService具体操作如下

    1.在web项目中添加引用

    Microsoft SDKs\RIA Services\v1.0\Toolkit\Libraries\Server\Microsoft.ServiceModel.DomainServices.Hosting.dll

    2.在webconfig里面添加

      <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" />
            <add name="Json" type="Microsoft.ServiceModel.DomainServices.Hosting.JsonEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </endpoints>
        </domainServices>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>

    3.在Query项目中添加service 引用。引用的路径

    http://yourServerName:port/services/serviceNameSpace-web-servicename.svc

  • 相关阅读:
    SQL SERVER 分布式事务(DTC)
    .NET 笔试题--自已作答
    设计模式-观察者模式
    设计模式-迭代器模式
    设计模式-责任链模式
    C#中引用类型和值类型
    另一个 OleDbParameterCollection 中已包含 OleDbParameter 错误分析及解决办法
    R语言笔记-set.seed()函数
    R中的sample函数
    R语言包相关命令
  • 原文地址:https://www.cnblogs.com/mjgb/p/1998924.html
Copyright © 2011-2022 走看看