通过在VS 2005中用Website建立WCF Service工程示例了解WCF Service的创建
1)建立一个Solution, 在这个Solution下添加一个用来建立WCF Service的Website以及测试这个WCF Service的测试Console Project。
2)在Website下建立WCF Service
     2.1)建立Service Contract,[ServiceContract()] [OperationContract()]
开始了解WCF[ServiceContract()]
开始了解WCF
public interface IHelloService
}
     2.2) 根据Service Contract,建立Service Implemention 
     2.3) 配置Service 
开始了解WCF  <system.serviceModel>
开始了解WCF    
<services>
开始了解WCF      
<service name="HelloService" behaviorConfiguration="Default">
开始了解WCF        
<endpoint contract="IHelloService" binding="wsHttpBinding"/>
开始了解WCF        
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
开始了解WCF      
</service>
开始了解WCF    
</services>
开始了解WCF    
<behaviors>
开始了解WCF      
<serviceBehaviors>
开始了解WCF        
<behavior name="Default">
开始了解WCF          
<serviceMetadata httpGetEnabled="true"/>
开始了解WCF        
</behavior>
开始了解WCF      
</serviceBehaviors>
开始了解WCF    
</behaviors>
开始了解WCF  
</system.serviceModel>
       注意点:对一个Service而言一定要一个对应的behavior, 且在声明endpoint时一定要有IMetadataExchange contract.
     2.4) 建立WCF Service Host
            在Website中添加一个扩展名为svc的文件,其中代码内容如下:       
%>

3)建立Service 测试客户端
    3.1)生成Service 代理文件
           SvcUtil.exe http://localhost:5000/WebSite/Service.svc
           用上面的命令可生成一个Service代理文件和一个Service客户端配置文件

    3.2)编写调用Service的代码

WCF 开发工具
C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin

http://msdn2.microsoft.com/zh-cn/library/ms732015.aspx
1) SvcConfigEditor.exe
2) SvcTraceViewer.exe

相关文章:

  • 2021-07-15
  • 2021-09-29
  • 2021-06-13
  • 2022-01-20
  • 2022-12-23
  • 2021-12-26
  • 2021-06-03
  • 2022-01-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
  • 2021-10-01
  • 2022-01-12
  • 2021-09-16
相关资源
相似解决方案