Web Service failed to create Excel Automation Instance Var.

pagum904
Member Posts: 2
Hi All,
I am testing a sample Console application code in .Net to create a Excel worksheet from NAV using the webservice. Below is the code sample.
.Net Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sample_Demo
{
using localhost;
class Program
{
static void Main(string[] args)
{
DemoCU ws = new DemoCU();
ws.UseDefaultCredentials = true;
ws.Url = "http://localhost:7047/DynamicsNAV/WS/CronusIndiaLtd/Codeunit/DemoCU";
string OutputString = "";
try
{
OutputString = ws.CreateExcel();
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
}
Console.WriteLine("Result: {0}", OutputString);
Console.ReadLine();
}
}
}
NAV Code
CreateExcel() : Text[250]
CLEAR(excel);
CREATE(excel);
book:=excel.Workbooks.Add;
sheet:=excel.ActiveSheet;
FileName := 'D:\WSExcel.xls';
sheet.Range('A1').Value := 'WS Test';
sheet.SaveAs(FileName,56);
book.Close;
excel.Quit;
EXIT('Success');
But while debugging the .Net code, Webservice is failed to create the instance of the Automation Variable.
Below is the error message
"This message is for C/AL Programmers: Unable to create an instance of Automation Server Microsoft Office Excel Application with CLSID = 00024500-0000-0000-c000-000000000046 Retrieving the COM class factory for component with CLSID {00024500-0000-0000-c000-000000000046} failed due to the following error: 80070005.."
Please can any one tell how Webservice will use the Automation variables written in NAV.
Thanks in Advance
I am testing a sample Console application code in .Net to create a Excel worksheet from NAV using the webservice. Below is the code sample.
.Net Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sample_Demo
{
using localhost;
class Program
{
static void Main(string[] args)
{
DemoCU ws = new DemoCU();
ws.UseDefaultCredentials = true;
ws.Url = "http://localhost:7047/DynamicsNAV/WS/CronusIndiaLtd/Codeunit/DemoCU";
string OutputString = "";
try
{
OutputString = ws.CreateExcel();
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
}
Console.WriteLine("Result: {0}", OutputString);
Console.ReadLine();
}
}
}
NAV Code
CreateExcel() : Text[250]
CLEAR(excel);
CREATE(excel);
book:=excel.Workbooks.Add;
sheet:=excel.ActiveSheet;
FileName := 'D:\WSExcel.xls';
sheet.Range('A1').Value := 'WS Test';
sheet.SaveAs(FileName,56);
book.Close;
excel.Quit;
EXIT('Success');
But while debugging the .Net code, Webservice is failed to create the instance of the Automation Variable.
Below is the error message
"This message is for C/AL Programmers: Unable to create an instance of Automation Server Microsoft Office Excel Application with CLSID = 00024500-0000-0000-c000-000000000046 Retrieving the COM class factory for component with CLSID {00024500-0000-0000-c000-000000000046} failed due to the following error: 80070005.."
Please can any one tell how Webservice will use the Automation variables written in NAV.
Thanks in Advance
0
Comments
-
Hi,
you must configure the Microsoft Dynamics NAV Business Web Services service to log on with the same dedicated domain user account as NAV Server.
Also the user account should have proper rights.0 -
Are you sure that excel is installed on the server?0
-
http://blog.crowe.co.nz/archive/2006/03/02/589.aspx
According to this, it's a permission problem and you are running the webservice under a custom account, this account has no right to create excel automation.
Does this help?0
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