ClientBase
このクラスを使用してRESTサービスと通信しようとしています。以下は私のコードです:
class MyService: ClientBase<IMyService>, IMyService
{
public GridVisionService(Uri baseAddress)
: base(new WebHttpBinding(), new EndpointAddress(baseAddress))
{
this.Endpoint.Behaviors.Add(new WebHttpBehavior());
}
#region IMyServiceMembers
public void DoSomething()
{
using (new OperationContextScope(this.InnerChannel)) // Line that throws the exception
{
WebOperationContext.Current.OutgoingRequest.Headers.Add("details", "details");
} // End of OperationContextScope
this.Channel.DoSomething();
}
#endregion
}
私は次のようにクラスを実行します。
MyService myService = new MyService(new Uri("https://localhost:8080/MyService/"));
ただし、HTTPSではなくHTTPを期待することについての例外をスローします。検索したところ、同じエラーの複数のインスタンスが見つかりましたが、すべての場合で、app.configが接続を構成していることがわかりました。私の場合、私はそうではありません。私のサービスにhttpsの使用を期待させる方法を誰かが知っていますか?