关闭用户会话 AXAPTA [英] Close user sessions AXAPTA
问题描述
我正在制作一个使用 Dynamics AX Business Connector 与 AX 连接的网站,它运行良好,但有时用户不会注销.
im making a website who uses the Dynamics AX Business Connector to connect with AX, it´s working fine but sometimes the users don´t logout.
这是我的代码:
Microsoft.Dynamics.BusinessConnectorNet.Axapta DynAx = new Microsoft.Dynamics.BusinessConnectorNet.Axapta();
try
{
DynAx.Logon(null, null, null, null);
//Execute some methods
DynAx.Logoff();
}
catch (Exception ex)
{
DynAx.Logoff();
}
并且在 ax 中我可以看到登录的用户.有时也会发生这种情况,这就是为什么我不知道可能是谁.也许 Dispose() 方法更好?.
and in ax i can see the users logged in. Again this happens sometimes, thats why i don´t know who may be. Maybe Dispose() Method it's better?.
感谢您花时间阅读本文.
Thank you for taking your time to read this.
推荐答案
登录/注销对我来说是正确的,但如果你说有时它没有,那么原因很可能是以下之一:
Logon/logoff works for me correctly, but if you're saying sometimes it doesn't, then the reason is most likely one of the following:
- 业务连接器可能不稳定.这不是 Microsoft 的优先事项,最终被贬值.
//Execute some methods
部分中发生的任何事情都可能会锁定或阻止注销.- 您可能需要更新内核才能获得业务连接器的更新版本
- The business connector can be flaky. It's wasn't a Microsoft priority and eventually was depreciated.
- Whatever is happening in your
//Execute some methods
section could be locking or preventing the logoff. - You may need to update your kernel to get an updated version of the business connector
在我的 AX2012R3 环境中,我可以成功地反复运行以下 PowerShell
代码.这将我指向上述原因之一.
In my AX2012R3 environment I can run the below PowerShell
code over and over with success. This points me towards one of the above as a cause.
Add-Type -Path "C:\Program Files\Microsoft Dynamics AX\60\BusinessConnector\Bin\Microsoft.Dynamics.BusinessConnectorNet.dll"
$ax = new-object Microsoft.Dynamics.BusinessConnectorNet.Axapta
$ax.logon($null, $null, $null, $null)
$b = $ax.CreateAxaptaRecord("userinfo")
$array = New-Object System.Collections.ArrayList
$b.ExecuteStmt("select id from %1")
while($b.found){
$array.add($b.get_field("id")) | out-null
$b.next() | out-null
}
$array | Format-Table -AutoSize
$ax.Logoff()
$ax.Dispose()
这篇关于关闭用户会话 AXAPTA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!