私のサービスから取得しようとしているときに、サービスエンドポイントに入っていないようです。サービスエンドポイントが見つかりませんか?
私が試した場合http://localhost:8000/hello/help私は<string>You entered help <string>
を見ると予想されるはずですが、代わりにエンドポイントがありません。私は設定ファイルに全く触れていないので、コンソールアプリケーションからホストしています。
ホスト:
namespace Host
{
class Program
{
static void Main(string[] args)
{
WebHttpBinding binding = new WebHttpBinding();
WebServiceHost host =
new WebServiceHost(typeof(Service1));
host.AddServiceEndpoint(typeof(IService1),
binding,
"http://localhost:8000/hello");
host.Open();
Console.WriteLine("Hello world service");
Console.WriteLine("Press <RETURN> to end service");
Console.ReadLine();
}
}
}
サービス1:
namespace WcfServiceLibrary1
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
public class Service1 : IService1
{
public string GetData(string value)
{
return string.Format("You entered: {0}", value);
}
IService1:
[ServiceContract]
public interface IService1
{
[WebGet(UriTemplate = "/{value}")]
string GetData(string value);
私はあなたが再びあなたを見てうれしいですね/私のURLはhttp:// localhost:8000/helloの最後のスラッシュ/私はそれはどちらでもかまいませんが、問題。 –
@ Garrith私は自分の答えを更新しました。私はOperationContractAttributeも見つからないことに気付きました。 –
運営契約がありませんでした! +1 –