使用Microsoft.SqlServer.Management在MSVCR80.dll上出现C ++失败

时间:2010-09-20 08:34:41

标签: c# c++ sql-server

我正在尝试在我的服务器上运行测试但由于来自MSVCR80.dll的一些C ++错误而失败。在我的机器上它运行顺利,但在服务器上,我找不到让它工作的方法。

这是我在运行测试时遇到的错误(抱歉是意大利语,但很容易理解,我猜,每个人都说意大利语,不是吗?):

 Class Initialization method Test.Quartz.GestioneQuartzTest.MyClassInitialize threw exception. System.Reflection.TargetInvocationException:  System.Reflection.TargetInvocationException: Eccezione generata dalla destinazione di una chiamata.
 --->  System.TypeInitializationException: L'inizializzatore di tipo di '<Module>' ha generato un'eccezione.
 --->  <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load during appdomain initialization.
 --->  System.DllNotFoundException: Impossibile caricare la DLL 'MSVCR80.dll': Routine di inizializzazione della libreria di collegamento dinamico (DLL) non riuscita. (Eccezione da HRESULT: 0x8007045A)..

和堆栈跟踪:

_encode_pointer(Void* )
_initatexit_app_domain()
LanguageSupport.InitializePerAppDomain(LanguageSupport* )
LanguageSupport._Initialize(LanguageSupport* )
LanguageSupport.Initialize(LanguageSupport* )
ThrowModuleLoadException(String errorMessage, Exception innerException)
ThrowModuleLoadException(String , Exception )
LanguageSupport.Initialize(LanguageSupport* )
cctor()
Microsoft.SqlServer.Management.Common.ExecuteBatch.GetStatements(String sqlCommand)
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query, ExecutionTypes executionType, Int32& statementsToReverse)
Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand)
Test.DataBaseHelper.ExecuteScriptFile(String RessourceName) in C:\CoreTest\TestHelper\DataBaseHelper.cs: line 35
Test.Quartz.GestioneQuartzTest.MyClassInitialize(TestContext testContext) in C:\CoreTest\Quartz\GestioneQuartzTest.cs: line 62

我尝试下载dll MSVCR80并将其放在windows / system32上,但它没有帮助。有人曾经遇到过这个问题吗?

请求任何帮助。

[编辑]

调试一个测试时,错误发生在那里(第二行):

  Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(svrConnection);
 return server.ConnectionContext.ExecuteNonQuery(scriptText);

脚本文本包含用于创建或删除表格以在与生产类似的环境中执行测试的代码。

[/编辑]

1 个答案:

答案 0 :(得分:0)

您是否尝试下载并安装Microsoft Visual C++ 2005 SP1 Redistributable?而不是仅下载单个DLL(可能缺少其他依赖项)?

编辑,就像在Visual Studio中运行解决方案一样: 好吧,鉴于堆栈跟踪,错误位置已经很明显了。由于这是一个加载本机DLL的错误,我更多地讨论了运行WinDBG,在这种情况下可能会提供有关加载内容和失败原因的更好信息。从异常代码和失败的方式判断(可能在DllMain期间,即LoadLibrary),我猜它是一个缺失的依赖。在这种情况下,WinDbg或DependencyWalker可以帮助你,但是使用DependencyWalker,你必须知道在哪里看,即要分析的模块。