Cannot create an instance of .NET class in NAS

Boom-Box
Member Posts: 27
Hi Gents,
I have found and read attentively quite a few related topics, but unfortunately none had a solution for my case:
I created a codeunit that reads emails from outlook in NAV 2015 using .NET variables. All works perfectly on the client, now I am trying to call it from the NAS.
Because it is being called from a server, I turned the RunOnClient property to No.
And I get the error:
I have installed office recently in the server, the DLLs in the client, service and GAC folders are all unblocked.
The code/variables that cause the error are:
I have redeclared and changed the variables to compiled them from scratch in this server after seeing some related issues in the forum but no good so far.
Any hint you can provide will be extremely helpful!
Thank you
I have found and read attentively quite a few related topics, but unfortunately none had a solution for my case:
I created a codeunit that reads emails from outlook in NAV 2015 using .NET variables. All works perfectly on the client, now I am trying to call it from the NAS.
Because it is being called from a server, I turned the RunOnClient property to No.
And I get the error:
Cannot create an instance of the following .NET Framework object: assembly Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, type Microsoft.Office.Interop.Outlook.ApplicationClass.
I have installed office recently in the server, the DLLs in the client, service and GAC folders are all unblocked.
The code/variables that cause the error are:
CLEAR(Application); Application := ApplicationClass.ApplicationClass(); where [b]Application [/b] Microsoft.Office.Interop.Outlook.Application.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' [b]ApplicationClass [/b]Microsoft.Office.Interop.Outlook.ApplicationClass.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
I have redeclared and changed the variables to compiled them from scratch in this server after seeing some related issues in the forum but no good so far.
Any hint you can provide will be extremely helpful!
Thank you
0
Comments
-
Hi,
probably this can help someone else, the answer to this was changing the service user to an user account with full permissions.
Now the same exact code gets a different error when running in the server:
"The type NavAutomation is unknown."
Do you know if this instance call has to be made any differently due to the fact it is being created in/by the server?
Thank you in advance0 -
The same code? The two lines you provided above? Or some other part you didn't disclose so far?0
-
FusionLog should give you some informations in case you have assembly loading failures
http://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net
http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx
- create the registry keys
- restart your NAV service
- run your function
- stop your NAV service
- get yourself a cup of coffee and read through the fusion logs0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions