cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ASP.NET : setting a Mega env property

Solved
Frequent Contributor

ASP.NET : setting a Mega env property

Dear all,

 

I am coding in ASP.NET, a test at the beginning ...  

 

Compilation is OK

 

In line 7 (CurrentAdministrator) I have got a

 

LINE7.png

 

//////////////////////////////////////////////////////////////////////////////

 

Dim oMega As MegaApplication

Dim oMegaEnv As MegaEnvironment

Dim oMegaDatabase As MegaDatabase

Dim oMegaRoot As MegaRoot

oMega =New MegaApplication

oMegaEnv = oMega.Environments.Item("C:\MEGA 2009 GR DATA\GROUPE")

oMegaEnv.CurrentAdministrator ="xxx"

oMegaEnv.CurrentPassword ="yyy"

oMegaDatabase = oMegaEnv.Databases.Item("MyBase")

oMegaRoot = oMegaDatabase.Open

sappli = oMegaRoot.GetCollection("Application").Add("TOTO")

 

Marshal.ReleaseComObject(oMegaRoot)

Marshal.ReleaseComObject(oMegaDatabase)

Marshal.ReleaseComObject(oMegaEnv) 

Marshal.ReleaseComObject(oMega)

 

//////////////////////////////////////////////////////////////////////////////

 

Any idea of what is wrong ?

Thanks a lot

Regards,

 

 

Lionel Mazurié
Tags (4)
3 Replies
Highlighted
Frequent Contributor

Re: ASP.NET : setting a Mega env property

Hello,

 

It seems that it is linked  with the declaration of MEGA

MEGA is well installed in the server.

 

System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {8ECA45C1-E744-44DC-82C2-F763725AFD8C} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)

 

 

Error is generated by line

oMega =New MegaApplication

 in the code bellow,

My code is has changed :

... ...

Imports mshtml

Imports SHDocVw

Imports MegaMapp

 

<System.Web.Script.Services.

ScriptService()> _

<System.Web.Services.

WebService(Namespace:="http://microsoft.com/webservices/")> _

<System.Web.Services.

WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

<

ToolboxItem(False)> _

Public

ClassWebService1Inherits System.Web.Services.WebService

<

WebMethod()> _

<

ScriptMethod(UseHttpGet:=True, ResponseFormat:=ResponseFormat.Xml)> _

<

PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _

<System.Runtime.InteropServices.

ComVisibleAttribute(True)> _

 

PublicFunction setMEGAInfos(ByVal CreateFile AsString) AsXmlDocument

 

Dim oMega AsMegaApplication

Dim oMegaEnv AsMegaEnvironment

Dim oMegaDatabase AsMegaDatabase

Dim oMegaRoot AsMegaRoot

Dim sappli AsString

'oMega = CreateObject("Mega.Application")

oMega =New MegaApplication

oMegaEnv = oMega.Environments.Item("C:\MEGA 2009 GR DATA\GROUPE")

oMegaEnv.CurrentAdministrator ="xxx"

 

Lionel Mazurié
Frequent Contributor

Re: ASP.NET : setting a Mega env property

A solution here :http://www.codeproject.com/Questions/274286/microsoft-office-interop-error

 

Linked with the rights on the MEGA COM Component

 

CUSTOCOM.png

Lionel Mazurié
Frequent Contributor

Re: ASP.NET : setting a Mega env property

Yes it was that on WINDOWS SERVER 2003.

 

Lionel Mazurié