2020年1月30日木曜日

WCFサービスを使用するサイトをhttps(SSL)対応しようとしたら、エラーが発生したThis collection already contains an address with scheme https. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.

エラーは、

This collection already contains an address with scheme https.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: This collection already contains an address with scheme https.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item

↓日本語に訳すると
このコレクションには既にスキームhttpsのアドレスが含まれています。このコレクションでは、スキームごとに最大1つのアドレスが存在できます。サービスがIISでホストされている場合、「system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled」をtrueに設定するか、「system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters」を指定することで問題を修正できます。
パラメーター名:アイテム
説明:現在のWeb要求の実行中に未処理の例外が発生しました。エラーの詳細とコードのどこで発生したかについては、スタックトレースを確認してください。

例外の詳細:System.ArgumentException:このコレクションには既にスキームhttpsのアドレスが含まれています。このコレクションでは、スキームごとに最大1つのアドレスが存在できます。サービスがIISでホストされている場合、「system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled」をtrueに設定するか、「system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters」を指定することで問題を修正できます。
パラメーター名:アイテム

です。エラーは、WCFサービスを複数のサービスで展開するなら、
multipleSiteBindingsEnabledを設定するか、baseAddressPrefixFiltersを設定するということです。

しかし、WCFサービスは1つしかないんだけどなぁって思いつつ、
multipleSiteBindingsEnabledをtrueにしたら、

When 'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled' is set to true in configuration, the endpoints are required to specify a relative address.If you are specifying a relative listen URI on the endpoint, then the address can be absolute.To fix this problem , specify a relative uri for endpoint

↓日本語訳
構成で「system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled」がtrueに設定されている場合、エンドポイントは相対アドレスを指定する必要があります。エンドポイントで相対リッスンURIを指定している場合、アドレスは絶対にできます。 、エンドポイントの相対URIを指定します

というエラーになりました。

相対URIで指定って、設定が面倒じゃん。。。嘘だろ?って思いSSLの設定を確認していくと複数のバインドがありました!
この設定を見直して一つにしたら、無事解決しました。

↓問題の設定

0 件のコメント:

コメントを投稿