平时很少写博文的,以前都是转载其他园友的文章,这几天有时间就自己尝试写一些wcf相关的文章,希望能给有需要的人带来一点帮助吧,水平有限再加上初次动手,写得不好还请多多包含!废话不多说了直接进入正题。

1.首先是项目结构(截图)命名不是很规范——仅自己练手用的

注意:WcfInterface是wcf的服务接口

        ProductService是wcf的服务的实现

        ProductSVCWebApp服务webapp

         productservice.svc通过net.tcp绑定协议对外发布服务

         messageservice.svc通过net.msmq绑定协议对外发布服务

              主要是通过web.config中的servicemodel配置节点实现,该节点中主要分为3部分完全可通过手工配置:bindings绑定、behaviors行为、services服务配置对外发布的服务终结点endpoint——详情请见以下代码

        ServiceModel是相关的数据契约

实战WCF中net.tcp和net.msmq绑定协议

一、wcfinterface项目是独立的服务契约

1.IMessage服务接口

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 using System.ServiceModel;
 7 using ServiceModel;
 8 
 9 namespace WcfInterface
10 {
11     [ServiceContract]
12     public interface IMessage
13     {
14         [OperationContract(IsOneWay=true)]
15         void Send(Message log);
16     }
17 }
IMessage服务接口

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
相关资源
相似解决方案