IClassFactory由于以下错误而失败:80040154类未注册(HRESULT中的异常:0x80040154(R



我有一个扫描模块,它在我自己的windows 8.1机器上运行良好,但在windows服务器2012上的IIS上发布代码时,我面临以下错误。

Creating an instance of the COM component with CLSID {850D1D11-70F3-4BE5-9A11-77AA6B2BB201} from the IClassFactory failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

我已经成功注册了wiaaut.dll(64位),但我仍然面临同样的问题。
以下是我的代码;

private ADFScan _scanner;
public EmpDetail()
{
    _scanner = new ADFScan();
}
protected void scan_Doc()
{
    _scanner.Scanning += new EventHandler<WiaImageEventArgs>(_scanner_Scanning);
    _scanner.ScanComplete += new EventHandler(_scanner_ScanComplete);
    ScanColor selectedColor = ScanColor.Color;
    int dpi = 150;//some scanners have a problem if you set a lower DPI
    _scanner.BeginScan(selectedColor, 150);
    //ADFScan will now raise a Scanning event for EACH document scanned.
    //then scan complete once there are no more documents to scan.
}

工作

可能的解决方法是将项目的平台从"任意CPU"修改为"X86"(在项目的属性中,构建/平台的目标)

根本原因

VSS互操作是使用32位框架的托管程序集,dll包含32位COM对象。如果在64位环境中运行此COM dll,则会收到错误消息。

最新更新