为什么Restfull WCF服务没有出现? [英] why Restfull WCF Service not appear ?

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

问题描述

我有一个Restfull Wcf服务,作为Getname()的方法,它返回一个字符串.
现在我尝试使用WCF测试客户端进行测试,但未在WCF测试客户端窗口上显示该方法.
请让我知道这是什么原因?
在此先感谢.
这是我的服务.

在IRestFullService.cs

i have a Restfull Wcf Service which as method as Getname(),It returns a string.
now i trying to test using WCF Test Client,but it didn''t shown the method on the WCF test client window.
pleas let me know what is the reason of this?
Thanks in Advance.
this is my service.

in IRestFullService.cs

using System.ServiceModel.Web;
namespace RestWcfGetname
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IRestFullService" in both code and config file together.
    [ServiceContract]
    public interface IRestFullService
    {
        [OperationContract]
        [WebInvoke(Method = "Get", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "json/id")]
        string GetPassedName(string id);
        [OperationContract]
        [WebInvoke(Method = "Get", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "")]
        string GetName();
    }
}



在RestFullService.svc



in RestFullService.svc

using System.ServiceModel;
using System.Text;

namespace RestWcfGetname
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "RestFullService" in code, svc and config file together.
    public class RestFullService : IRestFullService
    {
        #region IRestFullService Members
        public string GetPassedName(string id)
        {
            return "i am from wcf service " + id;
        }
          public string GetName()
          {
              return "Hi Welcome to WCF Service";
          }
      #endregion
    }
}

推荐答案

是的,他们采用直接休息模板的最新框架可能会出现在这个模板上,或者可以在visualstudio的在线模板中下载
yea in latest frame work they atached direct rest template may it present on tht one or u can download it in online templates in visualstudio


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

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