【发布时间】:2012-01-23 13:13:32
【问题描述】:
我正在为外部定义的 WSDL 开发 Web 服务。使用 HTTP/S(服务器和客户端证书)进行访问,请求和响应都使用各自的证书进行签名。我已经在 VS2010 中导入了带有服务引用的 WSDL,并向 MessageContracts 添加了签名,设置了配置文件以执行安全性和 https 并在端口上设置 SSL。
我快要让它工作了,但我需要启用手动寻址以在响应中插入 wsa:To 元素,但不知道如何让它工作..
任何帮助表示赞赏。
这是我当前的配置部分:
<bindings>
<customBinding>
<binding name="AfleverServiceSoapBinding_V1_1">
<security defaultAlgorithmSuite="TripleDesRsa15"
authenticationMode="MutualCertificateDuplex"
requireDerivedKeys="false"
securityHeaderLayout="Lax"
includeTimestamp="true"
keyEntropyMode="CombinedEntropy"
messageProtectionOrder="EncryptBeforeSign"
messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
requireSignatureConfirmation="false"
allowSerializedSigningTokenOnReply="true"
enableUnsecuredResponse="False">
<localClientSettings cacheCookies="true"
detectReplays="true"
replayCacheSize="900000"
maxClockSkew="00:05:00"
maxCookieCachingTime="10:00:00"
replayWindow="00:05:00"
sessionKeyRenewalInterval="10:00:00"
sessionKeyRolloverInterval="00:05:00"
reconnectTransportOnFailure="true"
timestampValidityDuration="00:05:00"
cookieRenewalThresholdPercentage="60"/>
<localServiceSettings detectReplays="true"
issuedCookieLifetime="10:00:00"
maxStatefulNegotiations="128"
replayCacheSize="900000"
maxClockSkew="00:05:00"
negotiationTimeout="00:01:00"
replayWindow="00:05:00"
inactivityTimeout="00:02:00"
sessionKeyRenewalInterval="15:00:00"
sessionKeyRolloverInterval="00:05:00"
reconnectTransportOnFailure="true"
maxPendingSessions="128"
maxCachedCookies="1000"
timestampValidityDuration="00:05:00"/>
<secureConversationBootstrap/>
</security>
<mtomMessageEncoding maxReadPoolSize="64"
maxWritePoolSize="16"
messageVersion="Soap11WSAddressing10"
maxBufferSize="65536"
writeEncoding="utf-8">
<readerQuotas maxDepth="32"
maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</mtomMessageEncoding>
<httpsTransport manualAddressing="false"
maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
allowCookies="false"
authenticationScheme="Anonymous"
bypassProxyOnLocal="false"
decompressionEnabled="true"
hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true"
maxBufferSize="65536"
proxyAuthenticationScheme="Anonymous"
realm=""
transferMode="Buffered"
unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true"
requireClientCertificate="true" />
</binding>
</customBinding>
</bindings>
其中大部分是自动生成的。
我知道我需要将httpsTransport 上的manualAddressing 属性设置为true,但随后出现异常,因为此设置处于消息级安全性。
有谁知道如何切换到传输级安全性同时保持其余部分不变?由于这是customBinding,因此security 元素上的mode 属性不可用。
非常感谢,步态。
顺便说一句,我知道如何在代码中设置wsa:To,但是除非我可以转到手动寻址,否则它会在编码响应中丢失。..
【问题讨论】:
标签: wcf security manual ws-addressing custom-binding