当我运行调用UserPrincipal.GetGroups的简单控制台应用程序时,它会枚举用户组,没有任何问题。但是,当我在同一台服务器上运行与同一用户相同的代码但从托管WCF的Windows服务运行时,我得到以下错误链:
Message : The socket transfer timed out after 00:00:10. You have exceeded the timeout set on your binding. The time allotted to this operation may have been a portion of a longer timeout.
Inner Exception
---------------
Message : The read operation failed, see inner exception.
Inner Exception
---------------
Message : The socket transfer timed out after 00:00:10. You have exceeded the timeout set on your binding. The time allotted to this operation may have been a portion of a longer timeout.
Inner Exception
---------------
Message : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
这可能与WCF线程模拟有关吗? WindowsIdentity.GetCurrent().Name
返回相同的用户,但是Thread.CurrentPrincipal.Identity.Name
是不同的 - 在控制台应用程序的情况下是空字符串,但在Windoes服务的情况下是模拟的WCF用户。