| View previous topic :: View next topic |
| Author |
Message |
JacquesDuPreez General User


Joined: 05 Nov 2004 Posts: 8 Location: South Africa
|
Posted: Fri Nov 05, 2004 4:46 am Post subject: Using OOo from ASP .NET |
|
|
Hi there!
I want to use OOo from an ASP .NET environment. My code works fine when I run it from a standard Windows concole application. But when I try to run the same code from aspx I get the following error:
Could not create an object of type 'com.sun.star.ServiceManager'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Could not create an object of type 'com.sun.star.ServiceManager'.
| Code: | | Dim objSM As Object = objServer.CreateObject("com.sun.star.ServiceManager") |
Where objServer is an instance of HttpServerUtility, and assigned ByRef from Page.Server ... |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Fri Nov 05, 2004 10:23 am Post subject: |
|
|
Do you need to configure the "new" environment to know about the OOo clases and such? Including libraries, for example. I am only guessing _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
JacquesDuPreez General User


Joined: 05 Nov 2004 Posts: 8 Location: South Africa
|
Posted: Sun Nov 07, 2004 10:51 pm Post subject: |
|
|
| pitonyak wrote: | | Do you need to configure the "new" environment to know about the OOo clases and such? Including libraries, for example. I am only guessing |
Maybe, maybe not ... I didn't configure the console app. Even if I could configure the ASP web app, I don't know how, because I can't reference OOo from it, because OOo is not really a true COM or .NET library... |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Mon Nov 08, 2004 12:20 am Post subject: |
|
|
What do you mean with "is not a true COM library"?
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
Fallen General User

Joined: 08 Nov 2004 Posts: 5
|
Posted: Mon Nov 08, 2004 6:52 am Post subject: |
|
|
| It is likley that the ASP.Net worker process does not have permission to automate that process. Run "dcomcnfg" from the Windows run dialog and grant the proper permission to IUSR_{machinename}, IWAM_{machinename}, and ASPNET. This works for Excel automation, but I can't say wether or not it will work for Oo. |
|
| Back to top |
|
 |
mneumann General User


Joined: 22 Sep 2003 Posts: 40 Location: Austria
|
Posted: Mon Nov 08, 2004 9:14 am Post subject: |
|
|
| I guess the reference to the right library is the first step to do. I know in MS Office you have a reference for every application. I dont know which library you need to reference for OpenOffice, but this is the first step so that Com will recognize what you need. I have read something that there is a com to UNO bridge that takes care of this job, but I have no clue how the libary would be named. But with some research on the OO website or the SDK that should be found. |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Mon Nov 08, 2004 11:07 am Post subject: |
|
|
mneumann: You're wrong with that. What you describe is only one way of connecting to a COM server, this one way is called early binding and is not possible with OOo, because OOo has not a specific .dll for this, in contrast to Excel or Word which do have those.
Statements like CreateObject(...) do use the late binding way thus getting the library during runtime by sending a specific request that is handled inside of OOo very specifically and if the connection is established this means the COM-UNO bridge is activated.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
mneumann General User


Joined: 22 Sep 2003 Posts: 40 Location: Austria
|
Posted: Mon Nov 08, 2004 11:24 am Post subject: |
|
|
| Well, I am just getting in that field of understanding automation server for myself. Do you say that late binding does not need to know any reference to the used library? How does VB then know which object to call? Is that all handled completely by COM? Just want to know. |
|
| Back to top |
|
 |
JacquesDuPreez General User


Joined: 05 Nov 2004 Posts: 8 Location: South Africa
|
Posted: Tue Nov 09, 2004 3:26 am Post subject: |
|
|
| Fallen wrote: | | It is likley that the ASP.Net worker process does not have permission to automate that process. Run "dcomcnfg" from the Windows run dialog and grant the proper permission to IUSR_{machinename}, IWAM_{machinename}, and ASPNET. This works for Excel automation, but I can't say wether or not it will work for Oo. |
Have have changed the Access Permissions, and Launch and Activation Permissions for these users on the My Computer > COM Security at the Console's Concolse Services.
I have also made the same changes for these users for the OpenOffice.org 1.1.0 Text Document under DCOM Config ... no success ... same error message is displayed.  |
|
| Back to top |
|
 |
JacquesDuPreez General User


Joined: 05 Nov 2004 Posts: 8 Location: South Africa
|
Posted: Tue Nov 09, 2004 3:28 am Post subject: |
|
|
| Cybb20 wrote: | What do you mean with "is not a true COM library"?
Christian |
It wasn't specifically developed as a COM component, it uses the COM-UNO bridge ... |
|
| Back to top |
|
 |
nfsilva Newbie

Joined: 25 Nov 2004 Posts: 1
|
Posted: Thu Nov 25, 2004 10:53 am Post subject: The only way I found... |
|
|
Hi!
The only way I found to do this:
1) Create a ActiveX in VB that use CreateObject to access OpenOffice
2) Call ActiveX (VB) from a ASP.NET page
The VB code I did:
Dim openOfficeObject As Object
Public Function CreateOpenOffice() As Object
Set openOfficeObject = CreateObject("com.sun.star.ServiceManager")
Set CreateOpenOffice = openOfficeObject
End Function
Public Sub RemoveOpenOffice()
Set openOfficeObject = Nothing
End Sub
Private Sub Class_Terminate()
Set openOfficeObject = Nothing
End Sub
My Project call "wrapperOpenOffice". In ASP call
Set o = CreateObject( "WrapperOpenOffice.Wrapper" )
if( o is nothing ) then
response.Write( "erro" )
else
Set c = o.CreateOpenOffice
o.RemoveOpenOffice
Set c = Nothing
Set o = Nothing
response.Write( "ok" )
end if
PS. Excuse my English. I'm from Brasil...
| JacquesDuPreez wrote: | | Cybb20 wrote: | What do you mean with "is not a true COM library"?
Christian |
It wasn't specifically developed as a COM component, it uses the COM-UNO bridge ... |
|
|
| Back to top |
|
 |
JacquesDuPreez General User


Joined: 05 Nov 2004 Posts: 8 Location: South Africa
|
Posted: Fri Nov 26, 2004 3:05 am Post subject: |
|
|
| Cool. thanX very much nfsilva... will try to do this during the next few days... it will be really cool to use OOo from ASP .NET. |
|
| Back to top |
|
 |
khaled_ik Newbie

Joined: 25 Apr 2006 Posts: 1 Location: israel
|
Posted: Tue Apr 25, 2006 5:25 am Post subject: |
|
|
| JacquesDuPreez wrote: | | Cool. thanX very much nfsilva... will try to do this during the next few days... it will be really cool to use OOo from ASP .NET. |
hi i am khaled..
i want to ask you JacquesDuPreez .. if your try sucsess.
because i try to do the same thinks.
and i have an error .
if you can help me .
my mail is khaled_ik@yahoo.com |
|
| Back to top |
|
 |
hol.sten Super User


Joined: 14 Nov 2004 Posts: 3532 Location: Hamburg, Germany
|
Posted: Tue Apr 25, 2006 10:28 am Post subject: |
|
|
| khaled_ik wrote: | | and i have an error . |
It's hard to help with no problem description. Try a more elaborate description.
Just a tip because this is a rather old thread.
With kind regards
hol.sten |
|
| Back to top |
|
 |
LarsB OOo Advocate


Joined: 31 Aug 2005 Posts: 445 Location: Hamburg, Germany
|
Posted: Tue Apr 25, 2006 11:58 am Post subject: Without any more info |
|
|
Hi,
also without any more information. I think I know what's the problem.
The ASP.NET User is with the standard settings to restricted and
don't have the permission to invoke the COM call. You first have to change
the processmodel in the machine.config. You can either let run the
ASP.NET process as System or as an User who has permission
to execute the internal COM call. Try searching this forum for details
on changing the processmodel. I wrote several answers on this knd
of questions.
Cheers,
LarsB _________________ AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In
http://www.OpenDocument4all.com/ |
|
| Back to top |
|
 |
|