WCF服务绑定使用allowInseCuretransport = true原因在客户端中更新服务参考失败
-
04-10-2019 - |
题
这是我在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>
我正在设置允许InsecureTransport = true,因为在生产中,服务将在SSL终止负载平衡器后面运行。从我的.NET 4.0客户端拨打服务没有任何问题,但是试图更新VS2010中的服务参考总是会导致错误:
System.ServiceModel.Channels.TransportSecurityBindingElement错误:安全策略导出失败。该绑定包含运输安全性,但没有实现ItransportTokenAssertionProvider的运输安全绑定元件。不支持此类政策导出的政策出口。
我了解它试图告诉我的东西 - 基本上,我在绑定上禁用了运输安全性,该绑定要求它避免损害凭借电线上行驶的凭据。但是 - 这就是重点 允许Insecuretransport. 。可能是代理生成器根本不知道此属性吗?
更新:
看起来WSDL生成器确实无法处理属性。我不得不回到消息级别的安全性和自我签名的开发证书。使用消息安全具有能够坚持开发的优势,而不是完全吹牛IIS。
<wsHttpBinding>
<binding name="wshttpDevelopmentBinding">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
解决方案
我遇到了同一问题。问题似乎是HTTP传输,因为它没有实现ItransportTokenAssertionProvider界面,但HTTPS确实如此。我能够解决这两种方法:切换我的自定义绑定以使用HTTPS Transport,该运输实现了接口,并将EnableUnSecuredResponse =“ true”添加到配置中的安全元素,或编写从HTTPTransportBindingElement派生但实现的自定义绑定。必要的接口。
不隶属于 StackOverflow