我有一个扫描模块,在我自己的Windows 8.1机器上工作正常,但在窗口服务器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.
}
答案 0 :(得分:0)
解决方法强>
可能的解决方法是将项目的平台从“任何CPU”修改为“X86”(在项目的属性,构建/平台的目标中)
<强>根本原因强>
VSS Interop是使用32位Framework的托管程序集,dll包含32位COM对象。如果在64位环境中运行此COM dll,则会收到错误消息。