CRM 2011: Reauthentication with _serviceProxy.Authenticate()

前提是你 提交于 2019-12-11 01:35:06

问题


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?


回答1:


Have you tried to monitor the token like described in Performance Best Practices?

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.



来源:https://stackoverflow.com/questions/12258908/crm-2011-reauthentication-with-serviceproxy-authenticate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!