日期:2014-05-17  浏览次数:20652 次

64位Script Task里面该如何引用Excel控件
本帖最后由 tvb5201314 于 2010-12-06 17:55:00 编辑 在64位系统内做了一个SSIS,里面有一个Script Task,引用了Microsoft.Office.Interop.Excel控件。
在VS里面是可以运行的。但是放到Job上面运行就会报错:

Executed as user: WORKGROUP\CHANELPOC$. Microsoft (R) SQL Server Execute Package Utility  Version 10.50.1600.1 for 32-bit  Copyright (C) Microsoft Corporation 2010. All rights reserved.    Started:  4:03:11 PM  Error: 2010-12-06 16:03:11.53     Code: 0xC0011007     Source: {2E3AE65F-2F3B-4E26-B009-807966E2E7AF}      Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted.  End Error  Error: 2010-12-06 16:03:11.53     Code: 0xC0011002     Source: {2E3AE65F-2F3B-4E26-B009-807966E2E7AF}      Description: Failed to open package file "C:\Users\Deployment\Desktop\ETLREF06\Integration Services Project1\Integration Services Project1\Package.dtsx" due to error 0x80070005 "Access is denied.".  This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  End Error  Could not load package "C:\Users\Deployment\Desktop\ETLREF06\Integration Services Project1\Integration Services Project1\Package.dtsx" because of error 0xC0011002.  Description: Failed to open package file "C:\Users\Deployment\Desktop\ETLREF06\Integration Services Project1\Integration Services Project1\Package.dtsx" due to error 0x80070005 "Access is denied.".  This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.  Source: {2E3AE65F-2F3B-4E26-B009-807966E2E7AF}  Started:  4:03:11 PM  Finished: 4:03:11 PM  Elapsed:  0.062 seconds.  The package could not be found.  The step failed.


如果不添加excel控件的话在job上面是可以完美运行的。到底要怎么做才行呢?
sql server是2008的。默认就是预编译的了。
------最佳解决方案--------------------
64位系统下的vs默认是没有microsoft控件的。而且script task默认是.net 2.0的。
首先把excel控件放到这个目录:
C:\Windows\Microsoft.NET\Framework\v2.0.50727
如果还不可以运行的话就是权限问题了。
打开 开始-〉administrator tools->Component Services
然后展开Component Services-〉computers->my computer->dcom config
找到Microsoft Excel&