I am using pkcs11 interop library to list available devices like this
using (Pkcs11 pkcs11 = new Pkcs11(_libraryPath, AppType.SingleThreaded))
{
List<Slot> slots = pkcs11.GetSlotList(SlotsType.WithTokenPresent);
//using slots
}
it works fine but when i use same code in web application or run it loop i am getting slots count as 0 even if device is connected.
What is the PKCS#11 library? Does it happen to be for a network-based device or one what has a corresponding service on the box? I suspect you do not have permissions to LPC/RPC to its corresponding server.