Web service in .net not able to create Excel com object

  • Thread starter Nalina Vemparala via .NET 247
  • Start date
N

Nalina Vemparala via .NET 247

(Type your message here)
Hi!
I created a web service in .net where in the web method makes call to a function in which I am creating an excel object using
Dim objXl As New Microsoft.Office.Interop.Excel.Application()
objXl.Workbooks.Open("C:\C\Test.xls")
objXl.Visible = True
However, I am getting the error Access denied, Cannot create Activex component.
The same code works in a ASP page and also in .net windows application.
But if I access this code through web service I get the error Access denied, Cannot create Activex component.
I checked the permissions etc for this web service project
Could anyone please help me please.
 
J

Joe H

the asp.net process runs under a special user. that user will not by
default have rights to resources outside the scope of the web service.
imagine what would happen if a web service could call ANY code on your
server. there are many ways to approach this depending on your environment
and what it is that you are trying to achieve. but at the most basic level,
you need to give the aspnet user the rights to launch excel.

Nalina Vemparala via .NET 247 said:
(Type your message here)
Hi!
I created a web service in .net where in the web method makes call to a
function in which I am creating an excel object using
Dim objXl As New Microsoft.Office.Interop.Excel.Application()
objXl.Workbooks.Open("C:\C\Test.xls")
objXl.Visible = True
However, I am getting the error Access denied, Cannot create Activex component.
The same code works in a ASP page and also in .net windows application.
But if I access this code through web service I get the error Access
denied, Cannot create Activex component.
 
D

Dino Chiesa [Microsoft]

Also, let's repeat that MS Office components were not designed to be used
from within server-based apps such as ASP.NET webservices (or ASP Pages for
that matter).

http://support.microsoft.com/default.aspx?scid=kb;EN-US;257757


--
Dino Chiesa
Microsoft Developer Division
d i n o c h @ ElideThis . m i c r o s o f t . c o m



Joe H said:
the asp.net process runs under a special user. that user will not by
default have rights to resources outside the scope of the web service.
imagine what would happen if a web service could call ANY code on your
server. there are many ways to approach this depending on your environment
and what it is that you are trying to achieve. but at the most basic level,
you need to give the aspnet user the rights to launch excel.

Nalina Vemparala via .NET 247 said:
(Type your message here)
Hi!
I created a web service in .net where in the web method makes call to a
function in which I am creating an excel object using
Dim objXl As New Microsoft.Office.Interop.Excel.Application()
objXl.Workbooks.Open("C:\C\Test.xls")
objXl.Visible = True
However, I am getting the error Access denied, Cannot create Activex component.
The same code works in a ASP page and also in .net windows application.
But if I access this code through web service I get the error Access
denied, Cannot create Activex component.
 
F

freekamel

Hi,
use "dcomcnfg.exe" to config your policy for Dcom
select the "Default Security pane", insert user everyOne and give it "special Access" right into the tre
option allowed
Restart Your system and good luck

N.B.: Word works very well but Excel not finds the default printer specified i
system registrykeys "[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\"
devices, printerports and windows like Microsoft suggests
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top