我寫的方法合同:爲什麼GET'時會出現這個WCF錯誤?
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, UriTemplate = "TestEchoWithTemplate/{message}", BodyStyle = WebMessageBodyStyle.Bare)]
string TestEchoWithTemplate(string s);
和實現方法:
public string TestEchoWithTemplate(string s)
{
return "You said " + s;
}
當我瀏覽的網址:
http://localhost:52587/VLSContentService.svc/rest/TestEchoWithTemplate/HelloWorld
我收到以下錯誤:
Operation 'TestEchoWithTemplate' in contract 'IVLSContentService' has a UriTemplate that expects a parameter named 'MESSAGE', but there is no input parameter with that name on the operation.
下產生了同樣的錯誤:
http://localhost:52587/VLSContentService.svc/rest/TestEchoWithTemplate/MESSAGE=HelloWorld 的http://本地主機:52587/VLSContentService.svc/REST/TestEchoWithTemplate消息=的HelloWorld
我在做什麼錯?
工作感謝您的幫助 – Exitos