This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- FlexNet Embedded
- :
- FlexNet Embedded Forum
- :
- .NET Acquire from Trusted Storage can not find feature
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Feb 16, 2018
12:38 PM
.NET Acquire from Trusted Storage can not find feature
When I try and do a LicenseManager.Acquire with license data from Trusted Storage, I get a Feature Not Found, even though I can see the feature in the collection. After I do a Capability Request, then the same feature can be found. The following is modified snippet from the CapabilityRequest.cs sample code. In the sample here, I get the first message saying the feature is found, but it fails in the first AcquireReturn sequence. After it processes the capability response, the second AcquireReturn is successful.
[FONT=Courier New]
using (licensing = LicensingFactory.GetLicensing(
IdentityClient.IdentityData,
strPath,
newHostId))
{
// The optional host name is typically set by a user as a friendly name for the host.
// The host name is not used for license enforcement.
// ** Set the machine name
licensing.LicenseManager.HostName = Environment.MachineName;
// The host type is typically a name set by the implementer, and is not modifiable by the user.
// While optional, the host type may be used in certain scenarios by some back-office systems such as FlexNet Operations.
licensing.LicenseManager.HostType = "FLX_CLIENT";
// Test code!
IFeatureCollection collection = licensing.LicenseManager.GetFeatureCollection(LicenseSourceOption.TrustedStorage);
var featFromCollection = (from feature in collection
where feature.Name == shcFeature
select feature).FirstOrDefault();
if (featFromCollection != null)
{
Util.DisplayInfoMessage(shcFeature + " version " + featFromCollection.Version + " found!");
}
AcquireReturn(shcFeature, shcVersion);
// create the capability request
ICapabilityRequestOptions options = licensing.LicenseManager.CreateCapabilityRequestOptions();
options.ForceResponse = true;
ICapabilityRequestData capabilityRequestData = licensing.LicenseManager.CreateCapabilityRequest(options);
byte[] binCapResponse = null;
// send the capability request to the server and receive the server response
Util.DisplayInfoMessage("Sending Capability Request");
CommFactory.Create(serverUrl).SendBinaryMessage(capabilityRequestData.ToArray(), out binCapResponse);
if (binCapResponse != null && binCapResponse.Length > 0)
{
Util.DisplayInfoMessage("Response received");
}
ICapabilityResponse response = licensing.LicenseManager.ProcessCapabilityResponse(binCapResponse);
AcquireReturn(shcFeature, shcVersion);
[/FONT]
[FONT=Courier New]
using (licensing = LicensingFactory.GetLicensing(
IdentityClient.IdentityData,
strPath,
newHostId))
{
// The optional host name is typically set by a user as a friendly name for the host.
// The host name is not used for license enforcement.
// ** Set the machine name
licensing.LicenseManager.HostName = Environment.MachineName;
// The host type is typically a name set by the implementer, and is not modifiable by the user.
// While optional, the host type may be used in certain scenarios by some back-office systems such as FlexNet Operations.
licensing.LicenseManager.HostType = "FLX_CLIENT";
// Test code!
IFeatureCollection collection = licensing.LicenseManager.GetFeatureCollection(LicenseSourceOption.TrustedStorage);
var featFromCollection = (from feature in collection
where feature.Name == shcFeature
select feature).FirstOrDefault();
if (featFromCollection != null)
{
Util.DisplayInfoMessage(shcFeature + " version " + featFromCollection.Version + " found!");
}
AcquireReturn(shcFeature, shcVersion);
// create the capability request
ICapabilityRequestOptions options = licensing.LicenseManager.CreateCapabilityRequestOptions();
options.ForceResponse = true;
ICapabilityRequestData capabilityRequestData = licensing.LicenseManager.CreateCapabilityRequest(options);
byte[] binCapResponse = null;
// send the capability request to the server and receive the server response
Util.DisplayInfoMessage("Sending Capability Request");
CommFactory.Create(serverUrl).SendBinaryMessage(capabilityRequestData.ToArray(), out binCapResponse);
if (binCapResponse != null && binCapResponse.Length > 0)
{
Util.DisplayInfoMessage("Response received");
}
ICapabilityResponse response = licensing.LicenseManager.ProcessCapabilityResponse(binCapResponse);
AcquireReturn(shcFeature, shcVersion);
[/FONT]
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Feb 18, 2019
08:49 AM
Hi Dale
It looks like you're missing the command to tell the licence manager to look in trusted storage for licence information. You need to do this:
licensing.LicenseManager.AddTrustedStorageLicenseSource();
before your first AcquireReturn() call.
I made the same mistake initially - I assumed that because I had passed a path for the trusted source into LicensingFactory.GetLicensing() that it would automatically be used. It is not.
Hope that helps.
CASmith
It looks like you're missing the command to tell the licence manager to look in trusted storage for licence information. You need to do this:
licensing.LicenseManager.AddTrustedStorageLicenseSource();
before your first AcquireReturn() call.
I made the same mistake initially - I assumed that because I had passed a path for the trusted source into LicensingFactory.GetLicensing() that it would automatically be used. It is not.
Hope that helps.
CASmith