2012-06-06 14 views
15

Ich kann nicht herausfinden, warum ich diesen Fehler erhalte, wenn ich meine Anwendung (MVC 3) ausführe. Das Projekt hat einen Verweis auf Microsoft.SQLServer.ManagedDTS. Ich habe sowohl SQL Server 2008 R2 als auch SQL Server 2012 (beide Express) installiert. Ich benutze 2012 mit dieser Anwendung.Konnte Datei oder Assembly nicht laden 'Microsoft.SqlServer.DTSRuntimeWrap'

Server Error in '/' Application.

Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Quellfehler:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.SqlServer.DTSRuntimeWrap' could not be loaded.

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:

[BadImageFormatException: Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192 System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +123

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11568160
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +485 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +79 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +337
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700896 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869125

Antwort

0

Die Microsoft.SqlServer.DTSRuntimeWrap.dll ist wahrscheinlich nicht in der GAC, was bedeutet, dass sie kopiert werden in Ihrem Web-Anwendung bin Ordner oder manuell hinzugefügt, um Ihre Maschine GAC (z. B. mit GACUTIL.exe). Sie können es wahrscheinlich in C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\ finden. Wenn Sie es von einem Ort wie diesem in Ihrem Visual Studio-Projekt referenziert haben, können Sie wahrscheinlich die Option unter Eigenschaften der Referenz für Kopieren lokal auf True setzen.

Beachten Sie, dass diese DLL möglicherweise nicht weitervertreibbar ist. Daher müssen Sie möglicherweise SSIS auf jedem Webserver installieren, auf dem die Anwendung ausgeführt wird, um die SSIS-Lizenzierung nicht zu verletzen. Sie müssen dies jedoch überprüfen.

+1

Auch für die Nachwelt: @ Schellacks Kommentar hier über Lizenzierung ist genau richtig. Die Runtime-DTS-Bits werden installiert, wenn Sie SSIS (Server-Lizenz) oder BIDS (Client-Lizenz) installieren. Also AFAIK gibt * eine Lizenzierungsimplikation in beide Richtungen. – piers7

34

Wenn dies ein Teil einer Webanwendung ist, müssen Sie die Ausführung von 32-Bit-Anwendungen aus dem Anwendungspool von IIS aktivieren. Dies wird dein Problem lösen.

+1

Ich weiß, dass dies ein alter Beitrag ist, aber als Referenz: Diese Antwort ist NUR wegen der zugrunde liegenden "BadImageFormatException" im Stack-Trace wahr - es gibt viele andere Möglichkeiten, wie Sie den Headline-Fehler erhalten könnten. – piers7

+2

Weitere Hilfe: Wechseln Sie zu IIS> Anwendungspools> Wählen Sie den relevanten Pool aus> Klicken Sie auf Rig und wählen Sie Erweiterte Einstellungen.> Ändern Sie "32-Bit-Anwendungen aktivieren". –

Verwandte Themen