【发布时间】:2015-02-21 17:06:16
【问题描述】:
我为我的 wcf 服务设置了一个自定义 ClaimsAuthenticationManager。现在我发现每个 wcf 调用都会执行 ClaimsAuthenticationManager.Authenticate 方法。相反,我希望每个会话执行一次,以避免不必要的开销。
根据微软:
声明身份验证管理器通常在每个会话中调用一次,但以下情况除外:为了传输安全,存在于传输层的令牌将在每次调用时调用一次声明身份验证,即使存在会话.
来源:https://msdn.microsoft.com/en-us/library/ee748487.aspx
由于我的自定义绑定不使用传输安全性,我认为没有理由每次调用都会执行 ClaimsAuthenticationManager.Authenticate。
有谁知道是否需要满足其他要求才能在每个会话中调用一次此方法?非常感谢您的任何建议。
wcf绑定配置:
<behaviors>
<serviceBehaviors>
<behavior name="defaultBehavior">
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200" />
<serviceCredentials useIdentityConfiguration="true" />
<serviceAuthorization principalPermissionMode="Always" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netNamedPipeBinding>
<binding name="ServiceNamedPipeBinding" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxReceivedMessageSize="134217728" maxBufferPoolSize="134217728" maxBufferSize="134217728" />
</netNamedPipeBinding>
<customBinding>
<binding name="TcpLoadBalanced" receiveTimeout="00:05:00" sendTimeout="00:05:00">
<security authenticationMode="SecureConversation" requireSecurityContextCancellation="true">
<secureConversationBootstrap authenticationMode="SspiNegotiated"/>
</security>
<binaryMessageEncoding>
<readerQuotas maxArrayLength="2147483647" />
</binaryMessageEncoding>
<tcpTransport listenBacklog="200" maxBufferPoolSize="134217728" maxReceivedMessageSize="134217728" maxBufferSize="134217728">
<connectionPoolSettings leaseTimeout="00:00:00" maxOutboundConnectionsPerEndpoint="0" />
</tcpTransport>
</binding>
</customBinding>
</bindings>
【问题讨论】:
-
你有没有得到任何地方?
标签: wcf wcf-binding wcf-security claims-based-identity wcf-sessions