CRM 2011:使用_serviceProxy.Authenticate()重新认证 [英] CRM 2011: Reauthentication with _serviceProxy.Authenticate()

查看:128
本文介绍了CRM 2011:使用_serviceProxy.Authenticate()重新认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用WCF频道和组织服务开发了用于ms dynamics 2011的客户端软件。创建频道后,我将其放入字典 Dictionary< string,OrganizationServiceProxy> 中,等待8个小时后,安全令牌不再有效。现在,我调用 serviceProxy.Authenticate()方法(serviceProxy是从我的集合中检索到的对象),但没有任何反应。我的令牌尚未更新,因此无法使用我的频道从动力学中检索数据。正如我在msdn中所读的那样, Authenticate()方法应该为我提供一个新令牌,我在做什么错了?

I have developed a client software for ms dynamics 2011 using WCF channel and organization service. After creating the channel I put it into dictionary Dictionary<string, OrganizationServiceProxy> and after 8 hours waiting was over, the security token was not valid any more. Now I call serviceProxy.Authenticate() method (serviceProxy is an object retrieved from my collection) and nothing happens. My token has not been renewed and I can not use my channel to retrieve data from dynamics. As I read in msdn, Authenticate() method should deliver me a new token, what am I doing wrong?

推荐答案

您是否尝试过像性能最佳做法


此外,监视WCF安全令牌(令牌)并在其过期之前刷新它,以便您不会丢失令牌,而必须重新开始进行身份验证。要检查令牌,请创建一个自定义类,该类继承自OrganizationServiceProxy或DiscoveryServiceProxy类,并实现用于检查令牌的业务逻辑。或将代理类包装在新类中。另一种技术是在每次调用Web服务之前显式检查令牌。 可以在帮助程序代码的ManagedTokenDiscoveryServiceProxy,ManagedTokenOrganizationServiceProxy和AutoRefreshSecurityToken类中找到演示这些技术的示例代码: ServerConnection 类主题。

In addition, monitor your WCF security token (Token) and refresh it before it expires so that you do not lose the token and have to start over with authentication. To check the token, create a custom class that inherits from the OrganizationServiceProxy or DiscoveryServiceProxy class and that implements the business logic to check the token. Or wrap the proxy classes in a new class. Another technique is to explicitly check the token before each call to the web service. Example code that demonstrates these techniques can be found in the ManagedTokenDiscoveryServiceProxy, ManagedTokenOrganizationServiceProxy, and AutoRefreshSecurityToken classes in the Helper Code: ServerConnection Class topic.

您将找到一个示例,说明如何自动在此类中更新令牌。

You will find an example of how you could automatically renew the token in this classes.

这篇关于CRM 2011:使用_serviceProxy.Authenticate()重新认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆