创建 WCF 通道后更改客户端凭据
我们构建的系统允许用户在创建 WCF 通道后更改其密码 - 有没有办法更改发送到服务器的凭据,而无需重新创建通道?
先感谢您。
The system we've built allows for a user to change their password after a WCF channel has been created - is there a way to change the credentials being sent through to the server without having to recreate the channel?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果通道已被使用,则凭证将变为只读且无法更改(如果凭证被修改,则会引发异常)。
如果通道尚未使用(并且关联通道工厂的状态为“已创建”或“正在打开”),则您可以通过以下方式更新凭据:
但是,根据您的问题,我猜测该通道已被使用。在这种情况下,恐怕您必须重新创建频道。
If the channel has already been used, then the credentials are made read only and cannot be changed (an exception is thrown if the credentials are modified).
If the channel has not been used (and the state of the associated channel factory is Created or Opening) then you can update the credentials in the following way:
However, from your question, I would guess that the channel has already been used. In which case you must re-create the channel I'm afraid.