私はRESTサービスを持っています。このサービスはhttpとhttpsで動作する必要があります。 web.configファイルに2つのエンドポイントを追加しようとしました。RESTサービスHttpとHttpsを使ったWebHttpBinding
はWebHttpBindingバインディングを持つ エンドポイントのスキームのhttpsと一致するベースアドレスが見つかりませんでした:私はHTTP経由で私のサービスを閲覧しようとすると、しかし、私はこのエラーを取得します。登録ベースアドレス体系 は[http]です。
と私はHTTPS経由で閲覧しようとすると、私はこのエラーを取得:
はWebHttpBindingバインディングとエンドポイントのスキームはhttpに一致するベースアドレスが見つかりませんでした。登録ベースアドレス方式は[https]です。
私の設定ファイルからエンドポイントの1つを削除すると、httpサービスとhttpsサービスがうまく動作します。 私はこのリンクをチェックしました:WebHttpBinding with Http and Https しかし、設定ファイルからエンドポイントを削除すると、httpとhttpsの両方のサービスがWebブラウザでエラーなく実行されます。しかし、私がこのサービスで自分の方法(残りのクライアントツールを介して)を呼び出そうとすると、次のようになります。
500内部サーバーエラー。
どうすればこのサービスをhttpとhttpsでエラーなく実行できますか?
私の設定ファイルは次のようである:ここ
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" bindingConfiguration="webHttpBinding"/>
<add scheme="https" binding="webHttpBinding" bindingConfiguration="webHttpsBinding"/>
</protocolMapping>
<bindings>
<webHttpBinding>
<binding name="webHttpBinding">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
<binding name="webHttpsBinding">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="MyProject.MyService" behaviorConfiguration="serviceBehavior">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="web" bindingConfiguration="webHttpBinding" contract="MyProject.IMyService" />
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="web" bindingConfiguration="webHttpsBinding" contract="MyProject.IMyService" />
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
<!--<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceAuthorization serviceAuthorizationManagerType="MyProject.RestAuthorizationManager, MyProject"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
この問題を解決できましたか? – Mese