[英]Configure MaxClockSkew in wsHttpBinding with TransportWithMessageCredential Security Mode
I have the following configuration for my service that is working fine. 我的服务具有以下配置,可以正常运行。 The problem appears when i need to change the value of MaxClockSkew in wsHttpBinding with TransportWithMessageCredential security mode.
当我需要使用TransportWithMessageCredential安全模式在wsHttpBinding中更改MaxClockSkew的值时,会出现问题。
How can I change the MaxClockSkew value in this configuration? 如何在此配置中更改MaxClockSkew值?
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="HttpsService_wsHttpBinding" closeTimeout="01:10:00"
openTimeout="01:10:00" receiveTimeout="Infinite" sendTimeout="Infinite"
maxBufferPoolSize="999999999" maxReceivedMessageSize="99999999">
<readerQuotas maxDepth="999999999" maxStringContentLength="999999999"
maxArrayLength="999999999" maxBytesPerRead="999999999" maxNameTableCharCount="999999999" />
<reliableSession inactivityTimeout="Infinite" enabled="true" />
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WcfServiceApp.Service1">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="HttpsService_wsHttpBinding"
name="wsHttpEndPoint" contract="CommonTypes.IService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="CommonTypes.CustomValidator, CommonTypes" />
</serviceCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
<bufferedReceive maxPendingMessagesPerChannel="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<diagnostics wmiProviderEnabled="true">
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
</system.serviceModel>
Based on the information in this post , it appears you can't change the maxClockSkew
property on a standard (ie, WCF-provided) binding, you need to use a custom binding. 基于这一信息后 ,它似乎无法改变
maxClockSkew
上一个标准的属性(即,WCF提供)绑定,您需要使用自定义绑定。 Something like this: 像这样:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="HttpsService_wsHttpBinding"
closeTimeout="01:10:00"
openTimeout="01:10:00"
receiveTimeout="Infinite"
sendTimeout="Infinite">
<reliableSession inactivityTimeout="Infinite"
enabled="true" />
<security authenticationMode="SecureConversation">
<secureConversationBootstrap authenticationMode="UserNameOverTransport" />
<localServiceSettings maxClockSkew="00:30:00" />
</security>
<textMessageEncoding messageVersion="soap12">
<readerQuotas maxDepth="999999999"
maxStringContentLength="999999999"
maxArrayLength="999999999"
maxBytesPerRead="999999999"
maxNameTableCharCount="999999999" />
</textMessageEncoding>
<httpsTransport maxBufferPoolSize="999999999"
maxReceivedMessageSize="99999999" />
</binding>
<customBinding>
</bindings>
</system.serviceModel>
Note that the clock skew is set in the <security>
section with the <localServiceSettings>
element's attribute maxClockSkew
(in this example, 30 minutes). 请注意,时钟偏斜是在
<security>
部分中使用<localServiceSettings>
元素的属性maxClockSkew
(在本示例中为30分钟)。 Custom bindings can be a little intimidating and/or confusing at first, but careful examination of the above example and using MSDN will be helpful. 最初,自定义绑定可能会有些吓人和/或令人困惑,但是仔细检查以上示例并使用MSDN会有所帮助。
CustomBindings is a good place to start, and note that the article indicates a specific order for the elements. CustomBindings是一个很好的起点,请注意,本文指出了元素的特定顺序。
For an overview of the config section elements and attributes, you can look here: <customBinding>
. 有关config节的元素和属性的概述,可以在这里查看:
<customBinding>
。
You will also need to set the maxClockSkew
property on the client's custom binding to the same value as the service, I believe. 我相信,您还需要将客户端的自定义绑定上的
maxClockSkew
属性设置为与服务相同的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.