We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Word embedded license file throwing cannot find license in .net 4.5

Hi,

We are currently using Aspose.Word to generate word documents, this currently works fine in .NET 3.5 but recently we have branched our code to have a .NET 4.5 version as well. This works fine in debug mode but when the code is complied in Release mode we get an error about the licence file not being found:

System.IO.FileNotFoundException: Cannot find license

Does anyone know why this is happening? I’ve done some searching through the forums and i noticed that Aspose.PDF has a .embedded property which has been used to solve this issue but there is no such property Aspose.Word.

Any help would be great,

Thanks


Any feedback on why this doesn’t work?

Hi Julian,


Thanks for your inquiry and sorry for the delayed response. After an initial test with Aspose.Words for .NET 13.7.0, I was unable to reproduce this issue on my side. Please create a simple application (for example a Console Application project) that helps me reproduce the same problem on my end and attach it here for testing. As soon as you send this application to me, I’ll start investigation into your issue. Thanks for your cooperation.

Best regards,

Hi Awais,

Thanks for your reply to my support issue, unfortunately i haven’t been able to reproduce the problem in a simple application and I’m unable to post the real application here.

We currently use Aspose.Word 13.1.0.0 in a VB.NET class library that has an embedded license file, this library is then reference and used in an ASP.NET web application. The code base is the same in 3.5 & 4.5 and it works in both builds for 3.5 and only debug in 4.5.

Can you think of anything that could be causing the issue for the 4.5 release build so i can troubleshoot further?

Thanks


Hi Awais,

I have some more information for you, i enabled debug info to full on the release build and i got this information about the error:

System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Reflection.RuntimeAssembly.VerifyCodeBaseDiscovery(String codeBase)
at System.Reflection.RuntimeAssembly.get_CodeBase()
at x28925c9b27b37a46.x220f433da4115056.x9b6c749de2abbbfb(Assembly xd3764619ec304ff0)
at x28925c9b27b37a46.x220f433da4115056.xde6236852622c268(String x1c1fc72fe1a3b4ea, Assembly x39e0a96279c40baa)
at x28925c9b27b37a46.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4)
at Dataract.e5.Web.ModalWord.CreateWord()
at Dataract.e5.Web.ModalWord.btnOK_Click(Object sender, EventArgs e)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PathDiscovery=“C:\inetpub\wwwroot\wss\VirtualDirectories\81\bin\Aspose.Words.DLL”/>

The demand was for:
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PathDiscovery=“C:\inetpub\wwwroot\wss\VirtualDirectories\81\bin\Aspose.Words.DLL”/>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version=“1”>
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Access=“Open”/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="ApplicationIsolationByUser"
UserQuota=“1024000”/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags=“Execution”/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"
Clipboard=“OwnClipboard”/>
<IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PublicKeyBlob="00240000048000009400000006020000002400005253413100040000010001005542E99CECD28842DAD186257B2C7B6AE9B5947E51E0B17B4AC6D8CECD3E01C4D20658C5E4EA1B9A6C8F854B2D796C4FDE740DAC65E834167758CFF283EED1BE5C9A812022B015A902E0B97D4E95569EB8C0971834744E633D9CB4C4A6D8EDA03C12F486E13A1A0CB1AA101AD94943236384CBBF5C679944B994DE9546E493BF"
Name="Aspose.Words"
AssemblyVersion=“13.1.0.0”/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Url=“file:///C:/inetpub/wwwroot/wss/VirtualDirectories/81/bin/Aspose.Words.DLL”/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Zone=“Internet”/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level=“SafePrinting”/>
<IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Audio="SafeAudio"
Video="SafeVideo"
Image=“SafeImage”/>
<IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Level=“Safe”/>


The assembly or AppDomain that failed was:
Aspose.Words, Version=13.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56
The method that caused the failure was:
System.String x9b6c749de2abbbfb(System.Reflection.Assembly)
The Zone of the assembly that failed was:
Internet
The Url of the assembly that failed was:
file:///C:/inetpub/wwwroot/wss/VirtualDirectories/81/bin/Aspose.Words.DLL

I’ve found a similar thread which discusses a similar issue but there doesn’t seem to be a fix:


We have in the web.config too.

Any help would be great,
Thanks

Any feedback on the above issue?

Thanks,

Hi Julian,


Thanks for your inquiry. I think this is a server security settings issue. Please see the discussion at the following thread:
http://forums.asp.net/t/1422162.aspx/1

Best regards,

Hi Awais,

Thanks for your reply. I’ve had a look at the thread you mentioned and it talks about users resolving similar issues using Trust=Full in the web.config, unfortunately i already have this in my config as mentioned above in my previous post.

Can you think of anything else? Also how does the Word & PDF API differ as the PDF API has an additional property when specifying a license to mark is as Embedded?

Thanks for your help

Hi Julian,


Thanks for your inquiry. Well, the exception occurs when application tries to get embedded resource. I am not sure but could you please try add the following mark-up in your web.config and see how it goes:

<system.web>
</system.web>

In this case the ASP.NET host does not apply any additional policy to applications that are running at the full-trust level. I hope, this helps.

Best regards,

Hi Julian,


Aspose.Pdf for .NET also offers the feature to use license as an embedded resource in your application. For further information, please visit Using as Embedded Resource

In the event of any further query, please feel free to contact.