Cannot create ActiveX in ASP.net

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
justinparkes
Posts: 7
Joined: Fri Apr 18, 2008 4:06 pm

Cannot create ActiveX in ASP.net

Post by justinparkes »

cannot CreateObject("com.sun.star.ServiceManager")

The error I get while running <varname> = CreateObject("com.sun.star.ServiceManager") is cannot create ActiveX object

I have got this working while running in dev mode (ie able to step through code) which means the worker process is running as the person I am logged in with (in this case Administrator), but when I access the page from another machine (on the same network) it falls over with cannot create ActiveX object on the line varname = CreateObject("com.sun.star.ServiceManager")

I think this is down to premission issues of the network user, so I have allowed network user permissions to open office in dcom+ which didnt solve it. I then tralled the registry giving permissions for anything with regards to openoffice and writer, still to no avail.

Has anyone out there experienced a similar issue? More importantly did you manage to get it resolved??

Details: Win2k3 server; ASP.NET 2.0; VS Express Edition 2008; IIS6.0

Thanks for any help offered.
justinparkes
Posts: 7
Joined: Fri Apr 18, 2008 4:06 pm

Re: Cannot create ActiveX in ASP.net

Post by justinparkes »

no takers huh?
User avatar
Villeroy
Volunteer
Posts: 31326
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot create ActiveX in ASP.net

Post by Villeroy »

This is the wrong forum, I'm afraid. How to create an ActiveX object with the appropriate user privileges is not related to OpenOffice.org.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
justinparkes
Posts: 7
Joined: Fri Apr 18, 2008 4:06 pm

Re: Cannot create ActiveX in ASP.net

Post by justinparkes »

Hi Villeroy,

Firstly, thanks for the reply. It is related to OpenOffice as I am trying to automate Writer to open a document, count the pages and return it to a variable in ASP.NET. The way this is acheived is by firstly creating the object 'CreateObject("com.sun.star.ServiceManager")'. Now when running the code under an Administrator account everything works perfectly. The problem comes in when running the same code under the ASP.NET user "Network Service". This is when the cannot create ActiveX object error occurs. This indicates that somewhere in OpenOffice it is restricting the user permissions somewhere. So I am asking the question whether anyone out there has got this to work. Am I making sense, or do you still feel this is not an OpenOffice issue?

Thanks

Justin
User avatar
Hagar Delest
Moderator
Posts: 32876
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Cannot create ActiveX in ASP.net

Post by Hagar Delest »

FI. I've moved the thread in the Macros>External programs forums (instead of Writer forum).

Good luck.
LibreOffice 24.8 on Xubuntu 24.10 and 24.8 portable on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31326
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot create ActiveX in ASP.net

Post by Villeroy »

As far as I remember this restriction could be due to a registry permission as well. It is a problem of your operating system or your file system respectively. OOo does not have any system of previleges other than those of the file system(s).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
justinparkes
Posts: 7
Joined: Fri Apr 18, 2008 4:06 pm

Re: Cannot create ActiveX in ASP.net

Post by justinparkes »

Hagar de l'Est - Thanks, hopefully I get some more responses here....

Villeroy, I have tralled through the registry and granted Network Service Full permissions for anything found using the search OpenOffice and writer. Do you by any small chance know of any other settings I should be looking to give Network Service permission to?
droopy
Posts: 1
Joined: Thu Oct 30, 2008 12:26 pm

Re: Cannot create ActiveX in ASP.net

Post by droopy »

I have the same problem if some one have the answer ...
Using IIS 6.0 under Windows 2003 server with openoffice 3.0
Thank you for answer
OOo 3.0.X on Ms Windows Other + XP PRO
peterb
Posts: 1
Joined: Wed Nov 12, 2008 5:40 pm

Re: Cannot create ActiveX in ASP.net

Post by peterb »

I have exactly this problem, also running IIS6, Win 2003 server, OpenOffice 3.0.

I have already created openoffice as a service, running as a specifically created user, and have opened openoffice using the runas command as the 'service' user, so I could run through the initial setup screens.

As i the previous posts this works fine when in dev mode, running through VS2005, however when trying in a browser to localhost it fails to create the activex object.

Any pointers would be gratefully received!
OOo 3.0.X on Ms Windows W2k
henrikop
Posts: 1
Joined: Wed May 04, 2011 4:39 pm

Re: Cannot create ActiveX in ASP.net

Post by henrikop »

Years later, I have the same problem.

oSM = CreateObject("com.sun.star.ServiceManager")
'Create the first and most important service
oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
'Open an existing doc (pay attention to the syntax for first argument)
oDoc = oDesk.loadComponentFromURL("file:///" & BestandNaamVoluit, "_blank", 0, arg)

Error I got is : cannot create ActiveX object

It's part of a method in a (2.0) webservice. If I debug localy and use the service I can render documents. If I publish the code to my local host, i get the error (on the same machine).

I made Network Services part of administrator, reboot, still persistent problem.

I altered launch option DCOM ( http://support.microsoft.com/kb/899965 ) then I don't get an error but time-outs and changing the time-out does not solve the problem.

I've read over a 60 topics, and found other people with the same problems, but no solution.

Willing to pay for a solution.
OpenOffice 3.1 on Windows 7 64bit
rudolfo
Volunteer
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: Cannot create ActiveX in ASP.net

Post by rudolfo »

Might be an issue with the user profile. No "com.sun.star.frame.Desktop" service without a user profile. If the activeX object is created with the rights of the webserver it might fail to create the files for the user profile in what ever home directory that would be?
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
Wolfling
Posts: 2
Joined: Tue Dec 06, 2022 5:33 am

Re: Cannot create ActiveX in ASP.net

Post by Wolfling »

I appreciate that your post was 12 years ago, but I have an answer.

It took me hours of research to get this working, and there are many steps involved:

1. Find the IIS AppPool\ApplicationIdentity (for me it was IIS AppPool\DefaultAppPool on the local IIS Server)
2. Give that identity read+execute permissions to C:\Program Files\LibreOffice
3. Create a folder for saving files/PDFs/etc. Grant Full Control permissions to the same identity.
4. You don't need to enable 32 bit applications for the application pool - if you're using the 64 bit version of LibreOffice. It is advised to set Load User Profile to True, but IIS defaulted it to True for me.
5. Use DCOMCNFG.exe to modify the LibreOffice Service Manager (Ver 1.0) to grant launch, activation and access permissions to the identity.
6. Note the application identity in DCOMCNFG. For me it was {82154420-0FBF-11d4-8313-005004526AB4}
7. In RegEdit, go to HKEY_CLASSES_ROOT\CLSID\{82154420-0FBF-11d4-8313-005004526AB4}\LocalServer32 (as per the ID you noted in step 6).
8. Change the default value of the key to include the appropriate start up command line parameters. For me, this was C:\Program Files\LibreOffice\program\soffice.exe -env:UserInstallation=file:///C:/LibreOffice --nodefault --nologo --headless
Note that C:\LibreOffice was the folder I created for step 3. Also note the URL format of the folder name in the command line.
9. Voila! IIS can now CreateObject("com.sun.star.ServiceManager"). Everything else follows nicely from there.
LibreOffice 7.3.7
JeJe
Volunteer
Posts: 2945
Joined: Wed Mar 09, 2016 2:40 pm

Re: Cannot create ActiveX in ASP.net

Post by JeJe »

Wolfling wrote: Tue Dec 06, 2022 5:34 am I appreciate that your post was 12 years ago, but I have an answer.
Welcome to the forum Wolfling - old threads being answered at last may help someone else in future even if the OP has moved on.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Wolfling
Posts: 2
Joined: Tue Dec 06, 2022 5:33 am

Re: Cannot create ActiveX in ASP.net

Post by Wolfling »

I've also received a good suggestion on another forum that the command line should include the --norestore parameter, and that the --nologo and --nodefault parameters are redundant if the --headless parameter is specified.

In my own development environment, I've found that getting IIS to rebuild the webpages that instantiate LO objects causes IIS to throw some process marshalling errors. For me, its important to keep production stable, so I'm having to change some of my deployment strategies to compensate - but that's a story for another forum :)
LibreOffice 7.3.7
Post Reply