Login fails when opensc-pkcs11.dll is used by an IIS invoked WebService

When I am using the NitroKey with opensc-pkcs11.dll from a WebService that runs under IIS.
When debugging from Visual Studio, which uses IIS Express everthing works fine. OpenSession and Login/Logout work as expected. But as soon as I run the release build that uses the regular installed IIS I get errors such as OpenSession returning non-zero return codes on the first run and then UserLogin() returning Invalid Handle Errors.
Are there known problems when opensc-pkcs11.dll is loaded from IIS?