Options

Web Service failed to create Excel Automation Instance Var.

pagum904pagum904 Member Posts: 2
edited 2011-10-17 in NAV Three Tier
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

Comments

  • Options
    dayakardayakar Member Posts: 68
    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.
  • Options
    kinekine Member Posts: 12,562
    Are you sure that excel is installed on the server?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    deV.chdeV.ch Member Posts: 543
    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?
Sign In or Register to comment.