我只创建了最基本的 WCF 服务应用程序来进行一些原型(prototype)设计,但我无法让 WebGet 实现正常工作。
这是我的界面:
[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 网络服务器。
最佳答案
我认为您缺少实际的服务名称。
关于c# - WCF 服务应用程序使用 WebGet 返回 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/848198/