JcBernack/WinBioNET

WinBioOpenSession failed: ConfigurationFailure

Closed this issue Β· 13 comments

Found 3 databases
DatabaseId 0: 1000f3b5-9412-490e-97ba-4aa5a1a171ae
DatabaseId 1: 6f970689-2e93-4fac-aa6e-f2ce6c9eb47c
DatabaseId 2: ae144bee-3f99-4711-b16c-e0883a3d2f6c
Found 1 units
Using unit id: 1
Device instance id: USB\VID_138A&PID_003D\00A080427C8C
Opening biometric session
Exception: WinBioException
WinBioOpenSession failed: ConfigurationFailure
at WinBioNET.WinBioException.ThrowOnError(WinBioErrorCode errorCode, String message) in C:\code\WinBioNET-master\WinBioNET-master\WinBioNET\WinBioException.cs:line 32
at WinBioNET.WinBio.OpenSession(WinBioBiometricType factor, WinBioPoolType poolType, WinBioSessionFlag flags, Int32[] unitArray, Guid databaseId) in C:\code\WinBioNET-master\WinBioNET-master\WinBioNET\WinBio.cs:line 45
at ConsoleTest.Program.Main() in C:\code\WinBioNET-master\WinBioNET-master\ConsoleTest\Program.cs:line 29

Windows 10, VS 2015

Please provide more details if you want help. What kind of device is this? What biometric sensor are you trying to use?
The exception is just telling you that the (very basic) test-application failed to initialize the sensor.

Hi ,
i am getting exception WinBioOpenSession failed: ConfigurationFailure when calling

var session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.Private, WinBioSessionFlag.Basic, new[] { unitId }, DatabaseId);

i am using device

Modelno: ZVETCO verifi P2000
Serial Number: 210290
Company URL: http://www.zvetcobiometrics.com/
Please suggest what is going wrong

Thanks

waiting your response

The ConsoleTest application was missing the part where the biometric database is created, I just added that. Configuring biometric databases unfortunately involves registry voodoo. I took the Guide from Microsoft and turned it into some helper methods you can access via WinBioConfiguration.

Basically the ConsoleTest was missing

WinBioConfiguration.AddDatabase(DatabaseId, unitId);
WinBioConfiguration.AddUnit(DatabaseId, unitId);

Thanks for your help
Now its working on windows demo but still having issue in console application while delete the .DAT file.
I will update what issue i am facing in console application.

Could you please guide how can i store user finger in sql server and identify/match from database

Thanks

The methods of WinBioConfiguration require elevated privileges (run as administrator) in case you didn't notice already. These methods are also far from perfect, e.g. RemoveDatabase will currently fail if the .dat file does not exist. If you want to use it in production you should improve on it (and send me a pull request πŸ‘).

As for using an SQL database as storage I can only give you hints. I have not done that and I don't know if or how this is possible at all.

The database configuration inserted into the registry contains a field called Attributes which contains settings on how the database is stored. See msdn here. There is a value called WINBIO_DATABASE_TYPE_DBMS. There is also a ConnectionString property. Maybe you can use those to configure it to use an SQL server.

If that doesn't work you might be able to implement a custom storage adapter in C and use that for your sensor by pointing the StorageAdapterBinary property of the sensor configuration in the registry to the dll.

I have no idea if any of this works, but I hope I could help you. Let me know if you get something to work!

Thanks a lot Bernack,
As i am new to this at all and will explore as you suggested.

I Will keep you posted ,if you find any way around ,please let me know

Thanks

I also had some issues with device verifi P2000 but I could make it work fine so I will share some things I did:

In WinBioNET\Configuration\WinBioDatabaseKey.cs I changed code to save the correct .DAT file:

using System;
using WinBioNET.Enums;

namespace WinBioNET.Configuration
{
public class WinBioDatabaseKey
: WinBioRegistryKeyBase
{
public WinBioBiometricType BiometricType;
public WinBioDatabaseFlag Attributes;
public int AutoCreate; //bool?
public int AutoName; //bool?
public int InitialSize; //bool?
public Guid Format;
public string FilePath;
public string ConnectionString;

    public WinBioDatabaseKey()
    {
    }

    public WinBioDatabaseKey(WinBioStorageSchema database)
    {
        Attributes = database.Attributes;
        Format = database.DataFormat;
        BiometricType = WinBioBiometricType.Fingerprint;
        AutoCreate = 1;
        AutoName = 1;
        InitialSize = 32;
        FilePath = Environment.SystemDirectory + string.Format(@"\WINBIODATABASE\{0}.DAT", database.DatabaseId.ToString().ToUpper());
        ConnectionString = "";
    }
}

}

In windowsformstest\winbioform.cs I added code to remove/add the database and also restart Windows Biometric Service to apply the changes:

protected override void OnLoad(EventArgs e)
{
var units = WinBio.EnumBiometricUnits(WinBioBiometricType.Fingerprint);
Log(string.Format("Found {0} units", units.Length));
if (units.Length == 0) return;
var unit = units[0];
_unitId = unit.UnitId;
Log(string.Format("Using unit id: {0}", _unitId));
Log(string.Format("Device instance id: {0}", unit.DeviceInstanceId));
Log(string.Format("Using database: {0}", DatabaseId));

        WinBioConfiguration.RemoveDatabase(DatabaseId);
        WinBioConfiguration.RemoveUnit(DatabaseId, _unitId);
        WinBioConfiguration.AddDatabase(DatabaseId, _unitId);
        WinBioConfiguration.AddUnit(DatabaseId, _unitId);

        RestartService("WbioSrvc", 5000);
        _session = WinBio.OpenSession(WinBioBiometricType.Fingerprint, WinBioPoolType.Private, WinBioSessionFlag.Basic, new[] { _unitId }, DatabaseId);
        //_session = WinBio.OpenSession(WinBioBiometricType.Fingerprint);
        Log("Session opened: " + _session.Value);
    }

    private void RestartService(string serviceName, int timeoutMilliseconds)
    {
        ServiceController service = new ServiceController(serviceName);
        try
        {
            int millisec1 = Environment.TickCount;
            TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);

            service.Stop();
            service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);

            // count the rest of the timeout
            int millisec2 = Environment.TickCount;
            timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds - (millisec2 - millisec1));

            service.Start();
            service.WaitForStatus(ServiceControllerStatus.Running, timeout);
        }
        catch
        {
            MessageBox.Show("Error restarting Windows Biometric Service", "Error", MessageBoxButtons.OK);
        }
    }

In WinBioNET\WinBioConfiguration.cs I added a verification for file exists:

public static void RemoveDatabase(Guid databaseId)
{
// find database, throws if not found
var database = WinBio.EnumDatabases(WinBioBiometricType.Fingerprint).Single(_ => _.DatabaseId == databaseId);
// delete template file, throws if not authorized
if (File.Exists(database.FilePath))
{
File.Delete(database.FilePath);
}
...

Also I granted control to my user for folder C:\Windows\System32\WinBioDatabase just in case :)

Thanks!

Daniel Liedke

Thanks very much, @dliedke! With your changes I was able to successfully use a second fingerprint scanner. Why don't you send a pull request to repository owner @JcBernack ? I'm sure this will help a lot of other people too. And we won't need to copy and paste your code in the project, because it will be already in the source code.

Sorry for the delay, I just accepted your PR. Thanks πŸ‘

@JcBernack, I have the same ConfigurationFailed exception if I don't create the private pool. I created a new ticket which relates to this as well. It would be amazing if someone could help me in this topic.

Related ticket: view
Also created a stackoverflow ticket for the private pool creation: view

Thank you

I have built the private pool creator app, and it created the private pool. I then changed the databaseid in WinBioNET to the one that pool creator used. However it still goes to ConfigureFailed. No matter if I run it with admin privileges or not. Please help!