NLicense not load

General information about Neurotechnology and its software

NLicense not load

Postby i4nnet » May 24, 2017 12:37

anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"
i4nnet
 
Posts: 5
Joined: May 24, 2017 12:15

Re: NLicense not load

Postby vaidasz » May 25, 2017 06:43

i4nnet wrote:anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"


Hello,

.Net dlls from the SDK depends on the native dlls in the SDK, i.e. Neurotec.dll depends on the NCore.dll. Your received error means that your application can not find the native dll.
There are two solutions for this issue. First one, the fastest and easiest one, is to copy all dlls from the SDK to the output folder of your application.
The second way is to add the path to SDK dlls into System environmental variable PATH and restart the computer.
Vaidas Z
Neurotechnology
vaidasz
Neurotechnology
 
Posts: 559
Joined: Apr 30, 2010 06:57
Location: Vilnius, Lithuania

Re: NLicense not load

Postby i4nnet » Jun 02, 2017 06:33

vaidasz wrote:
i4nnet wrote:anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"


Hello,

.Net dlls from the SDK depends on the native dlls in the SDK, i.e. Neurotec.dll depends on the NCore.dll. Your received error means that your application can not find the native dll.
There are two solutions for this issue. First one, the fastest and easiest one, is to copy all dlls from the SDK to the output folder of your application.
The second way is to add the path to SDK dlls into System environmental variable PATH and restart the computer.



Dear sirs, for your information, i have tried the two solutions you sugested to me, but it didn"t work out. Is there any alternative to solve this problem?
i4nnet
 
Posts: 5
Joined: May 24, 2017 12:15

Re: NLicense not load

Postby MartynasV » Jun 02, 2017 12:56

i4nnet wrote:
vaidasz wrote:
i4nnet wrote:anyone can help me?

i have trouble with NLicense in c#, when i check license of neurotec in debug mode, and then show error "The Type initializer for Neurotec.Licensing.NLicense Threw an exception bla bla bla : Unable to load DLL NLicensing: The specified module could not be found HResult 0x8007007E"


Hello,

.Net dlls from the SDK depends on the native dlls in the SDK, i.e. Neurotec.dll depends on the NCore.dll. Your received error means that your application can not find the native dll.
There are two solutions for this issue. First one, the fastest and easiest one, is to copy all dlls from the SDK to the output folder of your application.
The second way is to add the path to SDK dlls into System environmental variable PATH and restart the computer.



Dear sirs, for your information, i have tried the two solutions you sugested to me, but it didn"t work out. Is there any alternative to solve this problem?

Hello,

No. You have to provide library (.dll) files for your program. Just copy all dlls from "SDK\Bin\Win32_x86 or Win64_x64 " to your program's working directory.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 248
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: NLicense not load

Postby Dilson » Nov 07, 2017 18:52

I found the error below already did the above process and it did not work.


The type initializer of "Neurotec.Licensing.NLicense" threw an exception. in Neurotec.Licensing.NLicense.ObtainComponents(String address, Int32 port, String components)

Below part of code:

string retorno = "";
int score = -1;

try
{
// Obtain license
if (!NLicense.ObtainComponents("/local", 5000, Components2))
{
throw new ApplicationException(string.Format("Could not obtain licenses for components: {0}", Components2));
}

using (var biometricClient = new NBiometricClient())
// Create subjects with face object
using (NSubject referenceSubject = CreateSubject(args[0], args[0]))
using (NSubject candidateSubject = CreateSubject(args[1], args[1]))
{
// Set matching threshold
biometricClient.MatchingThreshold = 48;

// Set matching speed
biometricClient.FacesMatchingSpeed = NMatchingSpeed.Low;

// Verify subjects
NBiometricStatus status = biometricClient.Verify(referenceSubject, candidateSubject);
if (status == NBiometricStatus.Ok || status == NBiometricStatus.MatchNotFound)
{
score = referenceSubject.MatchingResults[0].Score;
//Console.Write("image scored {0}, verification.. ", score);
//Console.WriteLine(status == NBiometricStatus.Ok ? "succeeded" : "failed");
}
else
{
//Console.Write("Verification failed. Status: {0}", status);
return -1;
}
}
}
catch (Exception ex)
{
//retorno = ex.Message;
retorno = ex.Message + ex.StackTrace;
//return TutorialUtils.PrintException(ex);
return -1;
}

return score;
Dilson
 
Posts: 4
Joined: Nov 07, 2017 17:00

Re: NLicense not load

Postby MartynasV » Nov 08, 2017 16:35

Dilson wrote:I found the error below already did the above process and it did not work.


The type initializer of "Neurotec.Licensing.NLicense" threw an exception. in Neurotec.Licensing.NLicense.ObtainComponents(String address, Int32 port, String components)

Below part of code:

string retorno = "";
int score = -1;

try
{
// Obtain license
if (!NLicense.ObtainComponents("/local", 5000, Components2))
{
throw new ApplicationException(string.Format("Could not obtain licenses for components: {0}", Components2));
}

using (var biometricClient = new NBiometricClient())
// Create subjects with face object
using (NSubject referenceSubject = CreateSubject(args[0], args[0]))
using (NSubject candidateSubject = CreateSubject(args[1], args[1]))
{
// Set matching threshold
biometricClient.MatchingThreshold = 48;

// Set matching speed
biometricClient.FacesMatchingSpeed = NMatchingSpeed.Low;

// Verify subjects
NBiometricStatus status = biometricClient.Verify(referenceSubject, candidateSubject);
if (status == NBiometricStatus.Ok || status == NBiometricStatus.MatchNotFound)
{
score = referenceSubject.MatchingResults[0].Score;
//Console.Write("image scored {0}, verification.. ", score);
//Console.WriteLine(status == NBiometricStatus.Ok ? "succeeded" : "failed");
}
else
{
//Console.Write("Verification failed. Status: {0}", status);
return -1;
}
}
}
catch (Exception ex)
{
//retorno = ex.Message;
retorno = ex.Message + ex.StackTrace;
//return TutorialUtils.PrintException(ex);
return -1;
}

return score;

Hello Dilson,

Check the InnerException property of the TypeInitializationException, it is likely to contain information about the underlying problem.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 248
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: NLicense not load

Postby Dilson » Nov 08, 2017 17:45

Hi,

Follows the result of the InnerException:

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
em Neurotec.Licensing.NLicense.NLicenseTypeOf(HNObject& hValue)
em Neurotec.NTypeReg..ctor(GetObjectPlain typeOf, Type type)
em Neurotec.NTypeMap.Add(GetObjectPlain typeOf, Type type, Type[] relatedTypes)
em Neurotec.Licensing.NLicense..cctor()
Dilson
 
Posts: 4
Joined: Nov 07, 2017 17:00

Re: NLicense not load

Postby MartynasV » Nov 09, 2017 08:54

Dilson wrote:Hi,

Follows the result of the InnerException:

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
em Neurotec.Licensing.NLicense.NLicenseTypeOf(HNObject& hValue)
em Neurotec.NTypeReg..ctor(GetObjectPlain typeOf, Type type)
em Neurotec.NTypeMap.Add(GetObjectPlain typeOf, Type type, Type[] relatedTypes)
em Neurotec.Licensing.NLicense..cctor()

Hello Dilson,

Error “An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)" is thrown, when the application is trying to load incorrect dlls. i.e. if your application is compiled with configuration “win64_x64” and the application is loading 32 bit dlls.
Or i.e. you have compiled the application with “AnyCPU” configuration and you are running the application on 64 bit OS and the application is loading 32 bit dlls.
Please check what configuration is used to build your application and if the correct dlls are loaded.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 248
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: NLicense not load

Postby Dilson » Nov 13, 2017 12:17

I have tested all the options that can not make it work.
I changed from AnyCPU to run in 32 bits put the dlls of my SDK Neurotec_Biometric_10_0_SDK_Trial\Bin\Win32_x86 did not work.
I also tested this way:
NLicense.Add ("Biometrics.FaceDetection");
NLicense.Add ("Biometrics.FaceExtraction");
NLicense.Add ("Biometrics.FaceSegmentsDetection");
But the error persists.
Dilson
 
Posts: 4
Joined: Nov 07, 2017 17:00

Re: NLicense not load

Postby MartynasV » Nov 13, 2017 12:51

Dilson wrote:I have tested all the options that can not make it work.
I changed from AnyCPU to run in 32 bits put the dlls of my SDK Neurotec_Biometric_10_0_SDK_Trial\Bin\Win32_x86 did not work.
I also tested this way:
NLicense.Add ("Biometrics.FaceDetection");
NLicense.Add ("Biometrics.FaceExtraction");
NLicense.Add ("Biometrics.FaceSegmentsDetection");
But the error persists.

Hello Dilson,

This is dll issue, not licensing.
Please write to support@neurotechnology.com with issue description.

P.S. You are using NLicense.Add() method incorectly, you have to read license file(.lic) as text and then add that text(string) using that method (after license is added you can obtain it).
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 248
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: NLicense not load

Postby Dilson » Nov 14, 2017 15:05

Hi,

I sent the email as requested.

Thank you!
Dilson
 
Posts: 4
Joined: Nov 07, 2017 17:00


Return to Public

Who is online

Users browsing this forum: No registered users and 2 guests