リバース プロキシ経由で ssl による基本認証を使用する Web サービスがあります。これを機能させる方法を理解するのにかなりの時間がかかりましたが、まだ完全に機能していません。
ブラウザーにhttps://domain.com/service.svcという URLを入力すると、資格情報の入力を求められ、正しい場合はサービスの概要ページが表示されます。それで大丈夫そうです。
しかし、サービスを Visual Studio 2010 に追加しようとすると、次のエラーが発生します。
メタデータに解決できない参照が含まれています: ドキュメント形式が認識されません (コンテンツ タイプは「text/html; charset=utf-8」です)。メタデータに解決できない参照が含まれています: 'https://domain.com/service.svc'。HTTP 要求は、クライアント認証スキーム「匿名」では許可されていません。サーバーから受信した認証ヘッダーは「Basic realm=NTLM」でした。リモート サーバーがエラーを返しました: (401) 権限がありません。現在のソリューションでサービスが定義されている場合は、ソリューションを構築して、サービス参照を再度追加してみてください。
これが私のweb.configです
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyBinding">
<!--<httpsTransport authenticationScheme="Basic"/>-->
<security mode="TransportCredentialOnly">
<transport clientCredentialType="None" proxyCredentialType="Basic" realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WcfService1.PortalService" behaviorConfiguration="NorthwindBehavior">
<host>
<baseAddresses>
<add baseAddress="https://domain.com/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyBinding" contract="WcfService1.IPortalService">
<!--<identity>
<servicePrincipalName value=""/>
</identity>-->
</endpoint>
<!--<endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="MyBinding" name="mex" contract="WcfService1.IPortalService"></endpoint>-->
</service>
</services>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="https://domain.com/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<!--<extensions>
<bindingElementExtensions>
<add name="httpsViaProxyTransport" type="WcfService1.HttpsViaProxyTransportElement, WcfService1"/>
</bindingElementExtensions>
</extensions>
<bindings>
<customBinding>
<binding name="UserNamePasswordSecured">
<textMessageEncoding />
<security authenticationMode="UserNameOverTransport" />
<httpsViaProxyTransport />
</binding>
</customBinding>
</bindings>-->
<behaviors>
<serviceBehaviors>
<behavior name="NorthwindBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceAuthorization principalPermissionMode="UseAspNetRoles"/>
<serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"/></serviceCredentials>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="SampleEndpointBehavior">
<!--<wsdlExtensions location="http://domain.com/PortalService.svc" singleFile="true"/> -->
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
この投稿に従うなど、多くのことを試しました:http: //blog.hackedbrain.com/2006/09/26/how-to-ssl-passthrough-with-wcf-or-transportwithmessagecredential-over-plain-http/成功しました。
また、wsdl がドメイン名の代わりにサーバー名を生成しているため、http にサイト バインディングを追加しようとしました。
うまくいけば、誰かが私にいくつかの指針を提供してくれるでしょう!
何百万もの異なる設定を試したため、web.configファイルには「ジャンク」が含まれていることに注意してください...