REST WCF服务中找不到端点错误 [英] Endpoint Not Found Error in REST WCF Service

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

问题描述

Hello Friends,

最近我以REST风格&将端点配置如下:

Recently I developed a WCF Service in REST Style & configured the endpoint as following:

<endpoint address="" binding="webHttpBinding" contract="IService" behaviorConfiguration=""/>



But I'm getting error "Endpoint Not Found" while Running the Service.

那么有人可以建议我该怎么做,以便我可以运行该服务吗?

So can anybody Suggest me what to do so that I can run the service ?

谢谢

推荐答案

您好,Gittu,

Hi Gittu,

以下是休息服务的基本样本.为了您的信息.

Below is a basic sample of rest servive. For your infomation.

[ServiceContract] public interface IEmployees { //all [WebGet(UriTemplate = "all")] IEnumerable<Employee> GetAll(); ...

} [数据合同] 公职员工 { [DataMember] 公共字符串ID {get;放; } ... }

} [DataContract] public class Employee { [DataMember] public string Id { get; set; } ... }

public class EmployeesService : IEmployees { private static IList<Employee> employees = new List<Employee> { new Employee{ Id = "001", Name="Micheal", Department="Dev", Grade = "G7"}, new Employee{ Id = "002", Name="Andy", Department="HR", Grade = "G6"} }; public IEnumerable<Employee> GetAll() { return employees; }

...

}

服务的配置:

<configuration>
    <system.serviceModel>
        <services>
            <service name="Service.EmployeesService">
                <endpoint address="http://127.0.0.1:3721/employees" 
                          binding="webHttpBinding" 
                          contract="Service.Interface.IEmployees"/>
            </service>
        </services>
    </system.serviceModel>
</configuration>

托管服务:

 using (WebServiceHost host = new WebServiceHost(typeof(EmployeesService)))
            {
                host.Open();
                Console.Read();
            }

如果不确定,请在此处发布更多信息.

If you have something unsure, please post more infomation here.

希望有帮助.

最好的问候.


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

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