20-09-2013 05:08 PM
Dear all,
I am coding in ASP.NET, a test at the beginning ...
Compilation is OK
In line 7 (CurrentAdministrator) I have got a
//////////////////////////////////////////////////////////////////////////////
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,
Solved! Go to Solution.
23-09-2013 01:49 PM
Yes it was that on WINDOWS SERVER 2003.
23-09-2013 10:26 AM
A solution here :http://www.codeproject.com/Questions/274286/microsoft-office-interop-error
Linked with the rights on the MEGA COM Component
23-09-2013 09:58 AM
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"