これは、web.config での私のサービス構成です。
<binding name="statefulSessionWithUsernameOverTransport">
<security authenticationMode="SecureConversation"
requireSecurityContextCancellation="False" allowInsecureTransport="True">
<secureConversationBootstrap authenticationMode="UserNameOverTransport"/>
</security>
<binaryMessageEncoding />
<httpTransport />
</binding>
<service name="com.example.FooService"
behaviorConfiguration="usernamePasswordAuthBehavior">
<endpoint contract="com.example.FooService.IFooService"
address="custom" binding="customBinding"
bindingConfiguration="statefulSessionWithUsernameOverTransport" />
</service>
私は allowInsecureTransport=True を設定しています。本番環境では、サービスが SSL ターミネーティング ロード バランサーの背後で実行されるためです。.Net 4.0 クライアントからサービスを呼び出すと問題なく動作しますが、VS2010 でサービス参照を更新しようとすると、常にエラーが発生します。
System.ServiceModel.Channels.TransportSecurityBindingElement エラー: セキュリティ ポリシーのエクスポートに失敗しました。Binding には TransportSecurityBindingElement が含まれていますが、ITransportTokenAssertionProvider を実装するトランスポート セキュリティ バインディング要素は含まれていません。このようなポリシー エクスポートのポリシー エクスポートはサポートされていません。*
私はそれが私に何を伝えようとしているのかを理解しています - それは基本的に、ネットワーク上を移動する資格情報を危険にさらすことを避けるために必要なバインディングでトランスポート セキュリティを無効にしたということです。しかし、それがallowInsecureTransportの要点です。プロキシ ジェネレータが単にこの属性を認識していない可能性はありますか?
アップデート:
wsdl ジェネレーターが実際に属性を処理できないようです。開発のために、メッセージ レベル セキュリティと自己署名証明書に戻る必要がありました。Message Security を使用すると、本格的な IIS に移行する代わりに、Cassini for Development に固執できるという利点がありました。
<wsHttpBinding>
<binding name="wshttpDevelopmentBinding">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>