0
私はClientBase
クラスを使ってRESTサービスと通信しようとしています。以下は私のコードです:ClientBaseとhttps接続。指定されたURIスキーム「https」は無効です。期待される 'http'。パラメータ名:via
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を使用することを期待できるようにする方法を知っていますか?
WebHttpsBindingクラスが見つからないようです。 WebHttpBindingクラスはSystem.ServiceModel名前空間にありますが、WebHttpsBindingクラスは存在しません。 – Kyle
私の悪い、私は答えを更新 –