Visual Studio 2010 で C# を使用して非常に基本的な WCF サービスを作成しています//localhost:49815/Service1.svc/methodName(parameterValue)
。
これが私のコードの本質です。
インターフェース:
using ...
namespace WcfService1{
[ServiceContract]
public interface IService1{
[OperationContract]
[WebGet]
string echoWithGet(string s);
[OperationContract]
[WebInvoke]
string echoWithPost(string s);
}
}
方法:
public string echoWithGet(string s ){
return "Get: "+s;
}
public string echoWithPost(string s){
return "Post: " + s;
}