You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MVC 5 C#执行SSIS包报错求助:无法找到64位安装程序

Troubleshooting SSIS Package Execution in MVC 5 (64-bit Runtime Issues)

Hey there! Let’s walk through how to fix your SSIS package execution problem in your MVC 5 app—especially that frustrating issue with finding the 64-bit runtime components. I’ve dealt with this exact scenario a few times, so let’s break it down step by step.

First: Understand the Root Cause

Visual Studio 2017’s SQL Server Data Tools (SSDT) is a 32-bit tool by default, but when you run SSIS packages from a 64-bit MVC app, you need the 64-bit SSIS Runtime installed separately. The error you’re seeing is almost certainly because your app is trying to access 64-bit components that aren’t present.

Step 1: Install the 64-bit SSIS Runtime

The SSIS Runtime isn’t included with SSDT—you have to install it separately, matching the SQL Server version tied to your VS2017 SSDT (which is SQL Server 2017). Here’s how:

  • Grab the SQL Server 2017 64-bit installation media from Microsoft’s official resources.
  • Run the installer, select New SQL Server stand-alone installation or add features to an existing installation.
  • On the "Feature Selection" screen, check the box for Integration Services—confirm the installation architecture is set to 64-bit (it should default to your system’s architecture, but double-check).
  • Complete the installation, then restart your machine to ensure components are registered properly.

Step 2: Adjust Your MVC 5 Code to Use 64-bit Runtime

Even with the runtime installed, you need to explicitly tell your code to use the 64-bit version. Here’s a corrected example using the Microsoft.SqlServer.Dts.Runtime namespace:

using Microsoft.SqlServer.Dts.Runtime;
using System;

public class SsisPackageExecutor
{
    public bool ExecutePackage(string packagePath)
    {
        var ssisApp = new Application();
        // Critical: Enable 64-bit runtime for package execution
        ssisApp.Enable64BitRuntime = true;
        Package ssisPackage = null;

        try
        {
            // Load your .dtsx package
            ssisPackage = ssisApp.LoadPackage(packagePath, null);
            
            // Execute the package
            var executionResult = ssisPackage.Execute();

            if (executionResult == DTSExecResult.Success)
            {
                Console.WriteLine("Package executed successfully!");
                return true;
            }
            else
            {
                // Log detailed errors from the package
                foreach (var error in ssisPackage.Errors)
                {
                    Console.WriteLine($"Error: {error.Description} | Source: {error.Source}");
                }
                return false;
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Execution failed with exception: {ex.Message}");
            return false;
        }
        finally
        {
            ssisPackage?.Dispose();
        }
    }
}

The line ssisApp.Enable64BitRuntime = true; is non-negotiable—without it, your app will default to 32-bit even if the 64-bit runtime is installed.

Step 3: Configure Your MVC Project for 64-bit

Make sure your MVC 5 project is set to run in 64-bit mode:

  • Right-click your project in Solution Explorer > Properties.
  • Go to the Build tab.
  • Under Platform target, select x64 (avoid "Any CPU" or "x86").
  • Save changes and rebuild your project.

Step 4: Check Permissions

Don’t overlook permissions! The identity your MVC app runs under (usually the IIS Application Pool identity) needs:

  • Read access to the folder where your SSIS package is stored.
  • Permissions to access any data sources used in the package (e.g., SQL Server databases, file shares).

Final Checks

After completing these steps, try running your app again. If errors persist, check the Windows Event Viewer for SSIS-related logs—they often have detailed clues about missing components or configuration missteps.

内容的提问来源于stack exchange,提问作者Hafizullah Mahmudi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 09:01:14