Announcements
Hello,
I have two classes. IN one of them I have a code:
new InteropPermission(InteropKind::ClrInterop).assert(); workbook.Close(true, fullFileName, missing); application.Quit(); CodeAccessPermission::revertAssert();
where workbook is Microsoft.Office.Interop.Excel._Workbook
on the string
workbook.Close(true, fullFileName, missing);
It stops the logic processing without giving any errors.
Also I have another class with the code inside:
System.Net.Mail.Attachment
Which gives me an error
CLRObject can't be created.
Both classes work fin on one AOS and do not work on the other so I suppose it's something to do with the either settings of the problematic AOS or some external libraries.
How to troubleshoot this?
Thanks.
See task manager for any open excels
I've checked it and I can open the file on the problematic AOS server under this account. Also there is an account connected to business connector and it also has full access to the file.
Yes, that's correct. That the process, and the user, which actually executes the code.
Thanks. What AOS service account do you mean? Is it domain service account under which AOS service is launched?
That you can open it doesn't necessarily mean that the AOS service account can open it too. That's the first thing that I would check.
Hello Martin,
Thanks a lot for your help.
The strange thing when I launch this class on the client it works. When I launch it on the AOS server it throws an error
Microsoft Excel can't access the file "\\path to the file\". It can happen due to one of the reasons below:
- file doesn't exist
- file is used by other app
- workbook name is the same as other workbook name currently opened
I have translated error from Russian.
I'm sure the file exists and I can open it from the AOS where class doesn't works. It's located on the shared folder on the file server.
So what is the difference when the class works on the client and on the server? ON the client it works fine, on the server it doesn't
The fact that "It stops the logic processing without giving any errors" suggests that you don't catch CLR exceptions. Add something like this:
try { ... your code using CLR Interop ... } catch (Exception::CLRError) { throw error(AifUtil::getClrErrorMessage()); }
It should give you a better idea about what's going on.
Hi Azat Mukhametzyanov,
Are you logging in directly into the AOS servers and running these classes? Is Office installed on one the AOS servers and not installed on the other?
André Arnaud de Cal...
294,118
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator