0

以下を使用して、コードでサービス参照を定義しています。

EndpointAddress NewEndPoint = 
new EndpointAddress("http://example.com/someservice.asmx");

sr_SomeService.SomeServiceSoapClient _SomeService = 
new sr_SomeService.SomeServiceSoapClient(
new System.ServiceModel.BasicHttpBinding(), NewEndPoint);

HTTP で EndPoint を使用すると、上記のコードは機能しますが、HTTPS アドレスを使用しようとすると、次のエラーが表示 されます。「http」が必要です。パラメータ名:経由

HHTPS エンドポイントを使用するにはどうすればよいですか?

4

1 に答える 1

0

これが答えのコードです:)

BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
EndpointAddress NewEndPoint = 
new EndpointAddress("https://example.com/someservice.asmx");

sr_SomeService.SomeServiceSoapClient _SomeService = 
new sr_SomeService.SomeServiceSoapClient(binding, NewEndPoint);

ポインタをありがとう。

于 2013-10-11T01:43:34.740 に答える