WCF服务应用程序使用WebGet返回404 [英] WCF Service Application returns 404 using WebGet

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

问题描述

我只是创建了最基本的WCF服务应用程序来进行一些原型制作,但是我无法使WebGet实现正常工作.

I created just the most basic WCF Service Application to do some prototyping, but I can't get the WebGet implementation to work.

这是我的界面:

[ServiceContract]
public interface IService
{
    [OperationContract]
    [WebGet(UriTemplate = "/rest/{value}")]
    string Test(string value);
}

这是实现:

public string Test(string value)
{
    return string.Format("You entered: {0}", value);
}

但是如果我在浏览器中转到 http://localhost:3305/rest/Hello ,我得到404.我正在使用VS 2008网络服务器.

But if I go to http://localhost:3305/rest/Hello in my browser, I get a 404. I'm using the VS 2008 webserver.

推荐答案

我认为您缺少实际的服务名称.

I think your missing the actual service name.

http://localhost:3305/yourservicename.svc/rest/Hello

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

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