WCF服务 [英] WCFService

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

问题描述

在Web服务中,我们将使用[Web方法]获得方法名称,我们将在wcf中编写类似的描述,任何人都可以知道该如何写给我帮助.?

in web services we will get method name using [Web method] we will write description like that in wcf what we will write can anybody know help me.?

推荐答案

在WCF中,您可以使用ServiceContract和OperationContract定义您的终点

http://msdn.microsoft.com/en-us/library/system.servicemodel. servicecontractattribute.aspx [ ^ ]

例如

In WCF you can use ServiceContract and OperationContract to define your end points

http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.aspx[^]

e.g.

using System;
using System.Collections.Generic;
using System.Net.Security;
using System.ServiceModel;
using System.Text;
namespace Microsoft.WCF.Documentation
{
  [ServiceContract(
    Namespace="http://microsoft.wcf.documentation",
    Name="SampleService",
    ProtectionLevel=ProtectionLevel.EncryptAndSign
  )]
  public interface ISampleService{
    [OperationContract]
    string SampleMethod(string msg);
  }
  class SampleService : ISampleService
  {
  #region ISampleService Members
  public string  SampleMethod(string msg)
  {
      return "The service greets you: " + msg;
  }
  #endregion
  }
}


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

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