2014-03-06 47 views
0

我正在處理一個需要曲線擬合的項目。爲了獲得最佳結果,我選擇使用MATLAB工具箱。我創建了這個代碼的一個dll,並試圖在C#.NET框架中使用它。該DLL可以在一個系統上成功運行,但不能在任何其他系統上運行。 我得到以下異常:當在C#.NET中使用時,matlab dll會拋出異常

Unhandled Exception: System.TypeInitializationException: The type initializer fo 
r 'curve.cfit' threw an exception. ---> System.TypeInitializationException: The 
type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception. -- 
-> System.TypeInitializationException: The type initializer for 'MathWorks.MATLA 
B.NET.Arrays.MWArray' threw an exception. ---> System.DllNotFoundException: Unab 
le to load DLL 'mclmcrrt7_17.dll': The specified module could not be found. (Exc 
eption from HRESULT: 0x8007007E) 
    at MathWorks.MATLAB.NET.Arrays.MWArray.mclmcrInitialize2(Int32 primaryMode) 
    at MathWorks.MATLAB.NET.Arrays.MWArray..cctor() 
    --- End of inner exception stack trace --- 
    at MathWorks.MATLAB.NET.Utility.MWMCR..cctor() 
    --- End of inner exception stack trace --- 
    at curve.cfit..cctor() 
    --- End of inner exception stack trace --- 
    at curve.cfit..ctor() 

我想知道這是爲什麼發生的事情,我怎麼能解決這個問題呢?我需要在多臺機器上部署我的項目。我該怎麼辦?

預先感謝您:)

回答

0

的這個錯誤告訴你該程序沒有找到mclmcrrt7_17.dll。這是您需要在每臺目標機器上部署的MATLAB編譯器運行時的一部分。它看起來像你還沒有部署MATLAB編譯器運行時。

運行時可再發行文件可以在這裏找到:http://www.mathworks.co.uk/products/compiler/mcr/index.html

+0

它的工作:d三江源這麼多的幫助 – zunman