Aspose.Cells License Error

Hi,


I implemented GroupDocs.Viewer in our project, then i try to implementent annotation but i get an license error from aspose. We use Aspose.Cells in our project too, i think maybe it can cause it. I disabled our aspose.cells license activation but it still give same error.

Here is the error that i get;

"

Server Error in ‘/eba.net’ Application.

        <h2> <i>This license is disabled, please contact Aspose to obtain a new license.</i> </h2>

        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

        <b> Description: </b>An unhandled exception occurred during 

the execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.

        <br><br>

        <b> Exception Details: </b>System.InvalidOperationException: This license is disabled, please contact Aspose to obtain a new license.<br><br>

        <b>Source Error:</b> <br><br>

        <table bgcolor="#ffffcc" width="100%">
           <tbody><tr>
              <td>
                  <code>

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

              </td>
           </tr>
        </tbody></table>

        <br>

        <b>Stack Trace:</b> <br><br>

        <table bgcolor="#ffffcc" width="100%">
           <tbody><tr>
              <td>
                  <code><pre>[InvalidOperationException: This license is disabled, please contact Aspose to obtain a new license.]

’’..˜(Stream ) +911
Aspose.Cells.License.SetLicense(Stream stream) +83

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +76
System.Delegate.DynamicInvokeImpl(Object[] args) +106
Groupdocs.Engine.Licensing.License`1.Apply(Stream stream) +163
Groupdocs.Engine.Licensing.LicenseSet.ApplyAll(Stream stream, Boolean forceApply) +345

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +159
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +256
System.Activator.CreateInstance(Type type, Boolean nonPublic) +127
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +14297981
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +198
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83
System.Web.Configuration.HandlerFactoryCache…ctor(String type) +57
System.Web.HttpApplication.GetFactory(String type) +94
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +375
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288


"

What cause it do you think? I try annotation in different project, it work fine but i cannot find what cause this error.

Hello,


We are sorry to hear that you have such issue. To resolve the issue you should use Aliases in the project in which you have several GroupDocs libraries.

Please investigate this example for how to.

Thank you.

Yes i use Alieses for GroupDoc.Viewer but not i didnt use for annotation. After your sugestion, i use Alieses for annotation too. But i still get same error.


Before doing it, viewer and annotation both give that error. But now only annotation give this error.

Hello,


Thank you for coming back. From your post we can assume that you have set different root storage paths for the Viewer and Annotation, unfortunately you should use exactly the same path for both libraries. Also make sure that you initialized the Viewer before the Annotation.

Thank you.

I’m giving the same path for them.


my code is like that

usings
"
extern alias GroupDocsViewer;
extern alias GroupDocsAnnotation;
using GDocsViewer = GroupDocsViewer.Groupdocs.Web.UI;
using GDocsAnnotation = GroupDocsAnnotation.Groupdocs.Web.Annotation;
using GDocsAnnotationV = GroupDocsAnnotation.Groupdocs.Web.UI.Viewer;
using GDocsEventHandling = GroupDocsAnnotation.Groupdocs.Web.UI.EventHandling;
using GDocsCommon = GroupDocsAnnotation.Groupdocs.Common;
"

code (page onInıt method)
"
string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
string cachePath = Path.Combine(Directory.GetParent(Path.GetDirectoryName(path)).Parent.FullName, @“DocumentViewers\ViewerCache”);
string licensePath = Path.Combine(Directory.GetParent(Path.GetDirectoryName(path)).Parent.FullName, @“DocumentViewers\GroupDocs.Total.for.NET.lic”);
GDocsViewer.Viewer.SetRootStoragePath(cachePath);
GDocsViewer.Viewer.EnableFileListRequestHandling(true);
GDocsViewer.Viewer.SetLicensePath(licensePath);
GDocsAnnotation.WidgetFactory.SetLicensePath(licensePath);
GDocsAnnotation.WidgetFactory.Initialize(this.Context, cachePath);
GDocsAnnotationV.Subscribe<GDocsEventHandling.DocumentOpenedEvent>(new DocumentOpenSubscriber());
GDocsViewer.DocumentCache cache = new GDocsViewer.DocumentCache(licensePath, cachePath);
        cache.RemoveOldEntries(<span style="color:blue;">new</span> TimeSpan(1, 0, 0));</pre></div><div><br></div><div>"</div>

Hello,


Thank you for the code example. From the code we can see that you use aliases in the wrong way. Please try to use this fixed code:
extern alias GroupDocsViewer;
extern alias GroupDocsAnnotation;

using GDocsViewer = GroupDocsViewer::Groupdocs.Web.UI;
using GDocsAnnotation = GroupDocsAnnotation::Groupdocs.Web.Annotation;
using GDocsEventHandling = GroupDocsAnnotation::Groupdocs.Web.UI.EventHandling;
using GDocsCommon = GroupDocsAnnotation::Groupdocs.Common;


string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
string cachePath = Path.Combine(Directory.GetParent(Path.GetDirectoryName(path)).Parent.FullName, @“DocumentViewers\ViewerCache”);
string licensePath = Path.Combine(Directory.GetParent(Path.GetDirectoryName(path)).Parent.FullName, @“DocumentViewers\GroupDocs.Total.for.NET.lic”);
GDocsViewer.Viewer.SetRootStoragePath(cachePath);
GDocsViewer.Viewer.EnableFileListRequestHandling(true);
GDocsViewer.Viewer.SetLicensePath(licensePath);
GDocsAnnotation.WidgetFactory.SetLicensePath(licensePath);
GDocsAnnotation.WidgetFactory.Initialize(this.Context, cachePath);
GroupDocsAnnotation::Groupdocs.Web.UI.Viewer.SubscribeGroupDocsAnnotation::Groupdocs.Web.UI.EventHandling.DocumentOpenedEvent>(new DocumentOpenSubscriber());
GDocsViewer.DocumentCache cache = new GDocsViewer.DocumentCache(licensePath, cachePath);

cache.RemoveOldEntries(new TimeSpan(1, 0, 0));

Also we can advise you to move the init code from the page onInit method to the Application_Start method in the globals.

Thank you.

Okay, i think i passed license issue but now error is evolved.


I change my code this
"
GDocsViewer.Viewer.SetRootStoragePath(cachePath);
GDocsViewer.Viewer.EnableFileListRequestHandling(true);
GDocsViewer.Viewer.SetLicensePath(licensePath);
GDocsAnnotation.WidgetFactory.SetLicensePath(licensePath);
GDocsAnnotation.WidgetFactory.Initialize(this.Context, cachePath);
"
to this

"
GDocsViewer.Viewer.SetRootStoragePath(cachePath);
GDocsViewer.Viewer.EnableFileListRequestHandling(true);
GDocsAnnotation.WidgetFactory.SetLicensePath(licensePath);
GDocsAnnotation.WidgetFactory.Initialize(this.Context, cachePath);
GDocsViewer.Viewer.SetLicensePath(licensePath);
"

Now i get error from “Microsoft.WindowsAzure.Storage.dll” when i add 2.0.0.0

It gives this error

"

StructureMap configuration failures:
Error: 170
Source:
Registry: StructureMap.Configuration.DSL.Registry, StructureMap,
Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable
to find the exported Type’s in assembly Groupdocs.Viewer,
Version=2.12.0.21022, Culture=neutral, PublicKeyToken=c037f897af36d52e.
One or more of the assembly’s dependencies may be missing.

Could not load file or assembly ‘Microsoft.WindowsAzure.Storage,
Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or
one of its dependencies. The located assembly’s manifest definition does
not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException:
Could not load file or assembly ‘Microsoft.WindowsAzure.Storage,
Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or
one of its dependencies. The located assembly’s manifest definition does
not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: ‘Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

"

When i changed it 4.3.0.0 it gives this error
"

StructureMap configuration failures:
Error: 170
Source:
Registry: StructureMap.Configuration.DSL.Registry, StructureMap,
Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223
Unable
to find the exported Type’s in assembly Groupdocs.Web.Annotation,
Version=1.8.0.11198, Culture=neutral, PublicKeyToken=null. One or more
of the assembly’s dependencies may be missing.

Could not load file or assembly ‘Microsoft.WindowsAzure.Storage,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or
one of its dependencies. The located assembly’s manifest definition does
not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException:
Could not load file or assembly ‘Microsoft.WindowsAzure.Storage,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or
one of its dependencies. The located assembly’s manifest definition does
not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: ‘Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

"

Hi again,


As we can see from the code you don’t use the advises that we shared with you. Could you please try to use the code that we shared with you earlier. pay attention for the syntax of the aliases and use the same as in the example (does you have tried the example project that we shared with you in the first post ? ). Also make sure that the Annotation initialized before the Viewer (as we said in the previous post).

Thank you.

Hi,


I’m apply your advises. You said first viewer then annotation. So i did like. I’m not put initialization on Application_Start because i build external dll, and i cant access it from dll. I have to load it just before opening viewer or annotation. Is it gonna be a problem? If it’s gonna be a problem, i try to find another way to put initializations in Application_Start.

I get dll’s from your sample project and my problem is gone. But there is another one. We’re not going to use sql compact. So i change web config like that “<add name=SaasposeDb connectionString=metadata=res:///Groupdocs.csdl|res:///Groupdocs.ssdl|res://*/Groupdocs.msl;provider=System.Data.SqlClient;provider connection string="Data Source=localhost;Initial Catalog=EBA;Persist Security Info=True;User ID=ebauser;Password=0" providerName=System.Data.EntityClient />”

But now i get this error

SqlCeCommand.CommandTimeout does not support non-zero values.

Message : Exception of type ‘System.Web.HttpUnhandledException’ was thrown.
Source : System.Web
Stack Trace
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.desktop_documentviewer_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\eba.net\c23cdb2c\5e3f7662\App_Web_bbzsib3u.17.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Message : SqlCeCommand.CommandTimeout does not support non-zero values.
Source : System.Data.SqlServerCe.Entity
Stack Trace
at System.Data.SqlServerCe.SqlCeMultiCommand.set_CommandTimeout(Int32 value)
at System.Data.Common.Utils.CommandHelper.SetStoreProviderCommandState(EntityCommand entityCommand, EntityTransaction entityTransaction, DbCommand storeProviderCommand)
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption)
at System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()<br>at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at Groupdocs.Data.MsSql.Account.UserRepository.GetUserByName(String userName)
at Groupdocs.Web.Annotation.Security.AuthenticationService.GetUserKey(String userName)
at Groupdocs.Web.Annotation.Security.AuthenticationService.get_UserKey()
at Groupdocs.Web.Annotation.AnnotationWidget.#qWcb()
at Groupdocs.Web.Annotation.AnnotationWidget.ToString()
at eBABaseDocumentViewer.eBAHTML5DocumentViewer.OnPreRender(EventArgs e) in c:\ebaproject\Development\dev\eBABaseDocumentViewer\eBAHTML5DocumentViewer.cs:line 77
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I fixed the last problem with this link thanks for help

Hello,


We glad to hear that the first issue is resolved.
As for the issue with the connection string -please update next properties:
1. Instead of localhost in the Data source - you should put your SQL server name. For example: .\SQLExpress
2. remove Persist Security Info=True;
3. Please change the password - it can’t be a “0”

For more info for how to use Annotation with the SQL server please check this documentation.

Thank you

For now its works only my developer machine, so its okay right now. But when i’m finished i’ll change it.


Thanks again.

Kind regards,