2016-10-04 45 views
0

我有一個ASP.net webforms項目,通過Business Connector文件版本(5.0.1500.4570)連接到axapta 2009。一切順利,直到突然我開始有這個錯誤登錄到axapta時出錯'Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException'

'Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException' occurred in ******.dataaccess.dll but was not handled in user code 

     at b2b.logosoft.com.tr.dataaccess.AxaptaConnectorHelper.AxaptaObject() in d:\Projects\B2B\b2b.logosoft.com.tr.site\b2b.logosoft.com.tr.dataaccess\AxaptaConnectorHelper.cs:line 29 
    at b2b.logosoft.com.tr.dataaccess.CurrencyDataAccess.GetCurrency(String fromcurrency, String tocurrency) in d:\Projects\B2B\b2b.logosoft.com.tr.site\b2b.logosoft.com.tr.dataaccess\CurrencyDataAccess.cs:line 14 
    at b2b.logosoft.com.tr.businessmanager.CurrencyService.GetCurrencyRate(String fromcurrency, String tocurrency) in d:\Projects\B2B\b2b.logosoft.com.tr.site\b2b.logosoft.com.tr.businessmanager\CurrencyService.cs:line 17 
    at b2b.logosoft.com.tr.businessmanager.CurrencyService.GetRates() in d:\Projects\B2B\b2b.logosoft.com.tr.site\b2b.logosoft.com.tr.businessmanager\CurrencyService.cs:line 80 
    at b2b.logosoft.com.tr.site.UserControls.Header.Page_Load(Object sender, EventArgs e) in d:\Projects\B2B\b2b.logosoft.com.tr.site\b2b.logosoft.com.tr.site\UserControls\header.ascx.cs:line 34 
    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) 

輸出爲:

'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-131200350151628806): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-131200350151628806): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-131200350151628806): Loaded 'C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.8387_none_5094ca96bcb6b2bb\msvcm90.dll'. Cannot find or open the PDB file. 
'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.8387_none_5094ca96bcb6b2bb\msvcm90.dll'. Cannot find or open the PDB file. 
'iisexpress.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\assembly\GAC_32\Microsoft.Dynamics.BusinessConnectorNet\5.0.0.0__31bf3856ad364e35\Microsoft.Dynamics.BusinessConnectorNet.dll'. Cannot find or open the PDB file. 
A first chance exception of type 'Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException' occurred in Microsoft.Dynamics.BusinessConnectorNet.dll 
A first chance exception of type 'Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException' occurred in b2b.logosoft.com.tr.dataaccess.dll 
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll 
A first chance exception of type 'Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException' occurred in Microsoft.Dynamics.BusinessConnectorNet.dll 
A first chance exception of type 'Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException' occurred in b2b.logosoft.com.tr.dataaccess.dll 
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-131200350151628806): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'. 
'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-131200350151628806): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.DebuggerVisualizers\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.DebuggerVisualizers.dll'. Cannot find or open the PDB file. 

這裏是連接器的輔助類:

public class AxaptaConnectorHelper 
{ 
    #region Class Properties 
    public static Axapta Ax { get; set; } 
    public static string UserName { get { return AxaptaConnectionInfo.AxUserName; } } 
    public static string Password { get { return AxaptaConnectionInfo.AxPassword; } } 
    public static string Domain { get { return AxaptaConnectionInfo.AxDomain; } } 
    public static string Company { get { return AxaptaConnectionInfo.AxCompany; } } 
    public static string Aos { get { return AxaptaConnectionInfo.AxAos; } } 
    #endregion 
    public Axapta AxaptaObject() 
    { 
     try 
     { 
      var nc = new NetworkCredential(UserName, Password, Domain); 
      Ax = new Axapta(); 
      Ax.LogonAs(UserName, Domain, nc, Company, "", Aos, ""); 
     } 
     catch (Exception ex) 
     { 
      Ax = null; 
      throw ex; 
     } 
     return Ax; 
    } 
} 

我曾嘗試如下:

  1. 清潔解決方案和重建
  2. 的業務接口卸下參考,然後重建
  3. 添加的業務接口的基準對所有在我的解決方案
  4. 改變了構建屬性目標平臺的x86爲這些項目所有的項目
  5. 清理臨時文件夾中的項目

似乎沒有任何解決的問題。

回答

1

A LogonFailedException只是表示您的objAX.Logon()objAX.LogonAs()失敗。這通常與構建或臨時文件夾沒有任何關係,但是您的代碼實際上無法使用主機名/端口/配置或用戶名連接到AOS。

您不顯示實際的代碼調用登錄/ logonas,但您的代碼或者找不到AOS或不能使用您提供的用戶名/密碼或您的服務/執行帳戶登錄到它。

確保服務正在運行,您可以連接到它(即無防火牆),並且用戶未被禁用或鎖定在Active Directory中,並且仍然是AX中的用戶。

試想想起來了,AOS(可能是羣集的一部分)可以拒絕連接known as draining

+0

我可以使用Axapta的桌面應用程序連接到Axapta的。這意味着我沒有被阻止,管理員審查了我的axapta登錄憑據,這一切都很好。 – iceDragon

+0

@iceDragon如何發佈一些代碼呢? –

+0

我已經添加了。錯誤發生在'Ax.LogonAs' – iceDragon