Activation Service Endpoint
By default, activation requests from the Software Potential Runtime on end-user machines are sent (on port 80) to http://srv.softwarepotential.com/SLMServerWS/ActivationWS.svc.
It is also possible to configure the SpAgent runtime to send activation requests over a secure HTTPS channel (on port 443) to https://srv.softwarepotential.com/SLMServerWS/ActivationWS.svc/SSL.
It is thus important that client firewalls, proxies etc. are configured to allow outbound connections to http://srv.softwarepotential.com [on port 80 and 443].
These endpoints do NOT require authentication.
Activation Over HTTPS (Port 443)
To configure SpAgent to send activation request over HTTP you need to set the correct EndPointSelectionPolicy in the ConfigureProduct method in the SpAgent.ProductCustomizations.cs file. You need to replace .WithEndpointSelectionPolicyDefault() with .WithEndpointSelectionPolicyHttpsOnly. When this is done the method should look as follows as follows:
static partial void ConfigureProduct( IProductContext productContext ) { productContext.Configure( configure => configure .Activation.Customize( activation => activation .WithTagging( AddActivationTags ) .WithTransmission( activationTransmission => activationTransmission .WithRetryPolicyDefault() .WithEndpointSelectionPolicyHttpsOnly .BeforeEachAttempt( WhenActivating ) .CompleteWithDefaults() ) .WithDeviceLabelPolicy( SetDeviceLabelPolicy ) .CompleteWithDefaults() ) .CompleteWithDefaults() ); }
Generating Activation Requests
Activation Key Checks
In your activation UI you should check the following before allowing the user to create an Activation Request, in either online or offline mode:
- Activation Key is of the correct length
- Activation Key is well formed
- There is no pending activation request (activation requests are submitted asynchronously).
An Activation Key should be 29 characters in length. It is best to check this before enabling the Activate button to to generate/submit the activation request.
To check the Activation Key is well formed:
bool IsActivationKeyWellFormed() { return SpAgent.Product.Activation.IsWellFormedKey( ActivationKey ); }
One approach to the above checks is to call CanActivate before attempting to activate the key:
bool CanActivate() { return !string.IsNullOrEmpty( ActivationKey ) && ActivationKey.Length == ActivationKeyRequiredLength && IsActivationKeyWellFormed() && !IsActivationInProgress; }
Online Activation Request
To submit an online Activation Request call the asynch method SpAgent.Product.Activation.OnlineActivateAsync( ActivationKey )
bool _activationInProgress; public bool IsActivationInProgress { get { return _activationInProgress; } set { _activationInProgress = value; } } void ActivateOnline() { SetActivationInProgress( true ); LastActivationResultMessage = string.Empty; var uiContext = TaskScheduler.FromCurrentSynchronizationContext(); SpAgent.Product.Activation.OnlineActivateAsync( ActivationKey ) .ContinueWith( task => OnActivationComplete( task, ActivationKey ), CancellationToken.None, TaskContinuationOptions.None, uiContext ); } void OnActivationComplete( Task task, string activationKey ) { SetActivationInProgress( false ); if ( task.IsFaulted ) { string errorMessage = task.Exception.Flatten().InnerException.Message; LastActivationResultMessage = "Error: " + errorMessage; } else { LastActivationResultMessage = "Successfully activated license with activation key " + activationKey; LastActivationSucceeded = true; ActivationKey = string.Empty; } } void SetActivationInProgress( bool isInProgress ) { IsActivationInProgress = isInProgress; }
Manual (Offline) Activation Request
To create a Manual Activation request you first need to create an Activation Request string, and then save that in a text file that can be submitted to the Software Potential Activation service.
string requestString = SpAgent.Product.Activation.Advanced().CreateManualActivationRequest(activationKey, null);
On successful activation on the Software Potential Activation Service a license file must be downloaded and copied to the device on which the activation request was generated.
To install the license from the license file:
//Read the license file into byte[] var licenseBlob = File.ReadAllBytes(licenseFilePathName); //Install the license file "file.bin" SpAgent.Product.Stores.Install(licenseBlob);
Comments
0 comments
Article is closed for comments.