我也使用角度和电子,但是以前一切都很好。这是一个错误:
Error: SCardConnect error:
SCardConnect error: The smart card cannot be accessed because of other connections outstanding.
(0x8010000b)
在第一次扫描卡后,它不再抛出错误,并在重新启动之前工作良好的读卡器。下面是一些与智能卡相关的代码片段:
const smartcard = require('smartcard');
const Devices = smartcard.Devices;
const devices = new Devices();
let currentDevices = [];
//something else
app.run(function($rootScope) {
let registerDevices = function (event) {
currentDevices = event.devices;
currentDevices.forEach(function (device) {
device.on('card-inserted', event => {
let card = event.card;
console.log(`Card '${card.getAtr()}' inserted into '${card.device}'`);
$rootScope.$broadcast('card-attach',card.getAtr());
});
device.on('card-removed', event => {
});
device.on('error', event => {
console.error("Card Reader Error: " + event);
});
});
};
devices.on('device-activated', event => {
console.log("Reader added :" + event.device);
registerDevices(event);
});
devices.on('device-deactivated', event => {
console.log("Reader removed :" + event.device);
registerDevices(event);
});
});
另外,当我断开扫描仪时,上面写着
events.js:160 Uncaught Error: SCardListReaders error: The Smart Card Resource Manager is not running.
(0x8010001d)
events.js:163 Uncaught Error: Uncaught, unspecified "error" event. ([object Object])
而扫描仪在重新连接后就不能工作了。
发布于 2016-11-20 00:15:15
这个错误代码是违犯 --一些进程已经以独占模式连接到卡上(使用排他性表示SCardConnect)。
假设你在Windows下
Windows中有一种即插拔机制,默认情况下,插入后立即自动访问每一张卡,并试图为其确定正确的驱动程序--这将在访问卡时创建一个短时间窗口(这是IMHO最可能的原因)。
你有两个选择:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ScPnP
下的注册表项HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ScPnP
设置为dword:0x00000000
(64位系统也将其设置为HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\ScPnP
) --参见例如这里。确保重新启动系统以使更改生效。关于你的编辑与0x8010001D (服务)错误代码和重新连接一个阅读器-我不知道。
祝好运!
https://stackoverflow.com/questions/40697650
复制相似问题