1
我在我的WCF服務和代理中使用自定義綁定。我通過從DuplexClientbase繼承來創建代理。 WCF中有一個選項可以幫助我獲取用戶名,誰調用了該方法?有沒有辦法從WCF方法檢索請求的Windows用戶名
這裏是我結合
<bindings>
<customBinding>
<binding name="CustomPipeBinding" maxConnections="10" openTimeout="01:20:00" receiveTimeout="20.00:00:00" sendTimeout="01:20:00" closeTimeout="01:20:00">
<windowsStreamSecurity protectionLevel="None" />
<namedPipeTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
<binding name="CustomTcpBinding" maxConnections="10" openTimeout="01:20:00" receiveTimeout="20.00:00:00" sendTimeout="00:05:00" closeTimeout="01:20:00">
<windowsStreamSecurity protectionLevel="None" />
<reliableSession />
<tcpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
謝謝:)我使用ServiceSecurityContext.WindowsIdentity.Name來獲取用戶名。在綁定中,我刪除了protectionLevel =「None」,默認情況下它是EncryptAndSign。 :) – Anuraj