Automation error, cannot create ActiveX object on .net

P

Patrick

I have a middle tier object that generates Excel spreadsheet
here is the code

moExcel = CreateObject("Excel.Application")
moWorkBook = moExcel.Workbooks.Add
moSheet = moWorkBook.Worksheets(liSheetNum)
moSheet.Delete()
moSheet = moWorkBook.Worksheets(liSheetNum)
moSheet.Delete()

We can this middle tier object from the web application, it runs fine
on my development box, but it gave me "Cannot create ActiveX
component." error when I depoly it to the server.

I wrote a simple win app that calls the same codes and tried to run
the win exe on the server box, and it gave me no error.

I think this has to do with security since the win exe is running
under the context of my login (admin) but the web application runs
under aspnet_wp account.

Please help!

Thanks!
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Patrick) scripsit:
I have a middle tier object that generates Excel spreadsheet
here is the code

moExcel = CreateObject("Excel.Application")
moWorkBook = moExcel.Workbooks.Add
moSheet = moWorkBook.Worksheets(liSheetNum)
moSheet.Delete()
moSheet = moWorkBook.Worksheets(liSheetNum)
moSheet.Delete()

We can this middle tier object from the web application, it runs fine
on my development box, but it gave me "Cannot create ActiveX
component." error when I depoly it to the server.

I wrote a simple win app that calls the same codes and tried to run
the win exe on the server box, and it gave me no error.

I think this has to do with security since the win exe is running
under the context of my login (admin) but the web application runs
under aspnet_wp account.

Is Excel installed on the server?
 
R

Rick Mogstad

Patrick said:
I have a middle tier object that generates Excel spreadsheet
here is the code

moExcel = CreateObject("Excel.Application")
moWorkBook = moExcel.Workbooks.Add
moSheet = moWorkBook.Worksheets(liSheetNum)
moSheet.Delete()
moSheet = moWorkBook.Worksheets(liSheetNum)
moSheet.Delete()

We can this middle tier object from the web application, it runs fine
on my development box, but it gave me "Cannot create ActiveX
component." error when I depoly it to the server.

I wrote a simple win app that calls the same codes and tried to run
the win exe on the server box, and it gave me no error.

I think this has to do with security since the win exe is running
under the context of my login (admin) but the web application runs
under aspnet_wp account.

So do I. Why dont you then change your permissions to give that account the permission to create
the excel objects, or change your code to run as a different user, that does have permissions.
 
P

Paul Clement

On 28 Oct 2003 10:14:17 -0800, (e-mail address removed) (Patrick) wrote:

¤ I have a middle tier object that generates Excel spreadsheet
¤ here is the code
¤
¤ moExcel = CreateObject("Excel.Application")
¤ moWorkBook = moExcel.Workbooks.Add
¤ moSheet = moWorkBook.Worksheets(liSheetNum)
¤ moSheet.Delete()
¤ moSheet = moWorkBook.Worksheets(liSheetNum)
¤ moSheet.Delete()
¤
¤ We can this middle tier object from the web application, it runs fine
¤ on my development box, but it gave me "Cannot create ActiveX
¤ component." error when I depoly it to the server.
¤
¤ I wrote a simple win app that calls the same codes and tried to run
¤ the win exe on the server box, and it gave me no error.
¤
¤ I think this has to do with security since the win exe is running
¤ under the context of my login (admin) but the web application runs
¤ under aspnet_wp account.
¤

See if the following articles help. They weren't written with ASP.NET in mind but you should be able
to apply the same logic:

INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/default.aspx?scid=kb;EN-US;257757

HOWTO: Configure Office Applications to Run Under a Specific User Account
http://support.microsoft.com/default.aspx?scid=kb;en-us;288367

HOWTO: Configure Office Applications to Run Under the Interactive User Account
http://support.microsoft.com/default.aspx?scid=kb;en-us;288366


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
P

Patrick

Thanks for the articles and it helped!

I got it working now, all i have to do is go to Dcom config, select
Microsfot Excel Application, grant permission to launch to "everyone"

Thanks for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top