The code I wrote that used Aspose.Excel in an ASP.Net page worked fine. A console utility worked well too. Later when I created the same methods in a class for a dll file part of a larger project, I encountered a security error:
System.IO.FileLoadException: Access is denied: 'Aspose.Excel'.File name: "Aspose.Excel" at *********.**********.ETLUtility.DataFile.ExcelToDataTable() at *************.*********.Research.Search.NPRB.Upload(Byte[] fileReadBuffer, Int32 uploadFileSize, String uploadFileName, String originalFileName, String contentType) in d:\cdo\research\search\prb\nprb.cs:line 455=== Pre-bind state information ===LOG: DisplayName = Aspose.Excel, Version=3.3.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56 (Fully-specified)LOG: Appbase = file:///D:/Data/************LOG: Initial PrivatePath = binCalling assembly : ETLUtility, Version=1.0.2060.18561, Culture=neutral, PublicKeyToken=null.===LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/root/dd42c740/ea0554e/Aspose.Excel.DLL.LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/root/dd42c740/ea0554e/Aspose.Excel/Aspose.Excel.DLL.LOG: Attempting download of new URL file:///D:/Data/westlaw/bin/Aspose.Excel.DLL.
By loading the dll into GAC, the error goes away:
gacutil /i aspose.excel.dll
100% ok!
But…
My client has a large xcopy deployment with a ‘no touch’ GAC policy for their production web farm.
Can I use a System.Security method or [assembly…] code in order to make the DLL load without putting it into GAC? I looked at the Aspose DLL using caspol.exe and it doesn’t look like you are doing anything unusual. I also switched off CAS but it did nothing to eliminate the error above.
The DLL appears to be looking at itself and its own directory for the license file which causes the exception.
Can you explain what might be the cause of the problem, and do you have any tips for getting it to work without putting it into GAC?
Or if you have any ideas on what I can try next I’d appreciate your help!
Oh, also I should mention that you should include the manifest in your DLL only patch releases. I tried one and it mis-matched with the XML file, so I needed to run with the 3.3.3. full msi installer version.
Aaron