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

mega api need to mega exe for work?

tunc
Super Contributor

Hi,

 

We want to work Mega Api in windows service , but it doesnt work  .Should We run mega exe before to work windows service or is there any way to just using mega.mapp and mega.Apim dll to get all info from mega.

 

 

Thanks.

9 Replies

Hello

 

I can confirm what Lionel says: mgwmapp.exe is not only a windows form.

This process is the core of the MEGA application run from a windows machine.

 

An instance of mgwmapp.exe is started whenever MEGA Deskop (Mega.exe) is run.

  • In interfactive mode
  • In batch mode (using Administration APIs)

This is by design. There is not way to change this behavior.

 

Jerome

lmazurie
Honored Contributor

Hi,

 

I am not the lab but mgwmapp.exe is not a form application. all my web services or batches are emulating this .exe that is the core executable of MEGA to pertform operations in the reposirtory in a "silent mode".

Could we have further infos (grab of error or xwarnings ? )

Thx  

 

 

Lionel Mazurié

tunc
Super Contributor

Hi,

 

Just simple question , Mega Api work in windows service and  while megaApi Open it is trigger of mgwmapp.exe .

 

mgwmapp.exe is a form application and while api try to run it. its terminate project because of it is windows service.

lmazurie
Honored Contributor

Could you read this post ?

 

http://community.mega.com/t5/Technical-Product/ASP-NET-setting-a-Mega-env-property/m-p/6839#M952

 

I don't know if it will help you to solve it !

 

Thx

Rgds,

 

 

Lionel Mazurié

tunc
Super Contributor

While Windows server connect to mega to get process. I think  , we should run client provider "Mega\MEGA 2009 SP5\System\mgwmapp.exe"   .Because of that exe is form appilcation . We Cant run form application from windows service  then we  cant connect mega. 

 

So that , is there different wat to connect mega different from  at the above logic?

tunc
Super Contributor

Mg_apim and mg_mapp referenced this project. While the Create MegaApplication .;Mega try to open exe

lmazurie
Honored Contributor

Hi,

 

Perharps it is not linked with your issue but are you referencing the

/system/mg_mapp.dll in you development project ?

 

Regards,

 

 

Lionel Mazurié

tunc
Super Contributor

While we create megaApplication , at the behinds it wants to work mega "mgwmapp.exe"  but in windows service doesnt permission. 

Im asking ,why mega should open that exe for working own api?

mtenzali
Retired

Hi,

 

Your demand is not clear about using windows service when running MEGA API. But, if I well understood the purpose of your question is how to create a API that will be launched automatically on a given a server without the intervention of an Admin.

 

If it's the case, you can code a script that will perform serial of actions to be led on the repository, dispatch the transaction and kill the MEGA process. Of course, you can configure this script with the task scheduler.

 

Here is an example of a script that connect to a given repository, create an application with the name "APP1", dispatch the transaction and kill the MEGA process.

 

Mohamed

Set oMegaRoot = Nothing

StrBDD = "Database"
strUser = "U1"
strpass = "PassWord"

Set MegaSite = CreateObject("mega.application")

strPathEnv = "C:\Users\Public\Documents\MEGA HOPEX V1R1\Env"
Set MegaEnv = MegaSite.Environments.Item(strPathEnv)

MegaEnv.CurrentAdministrator = strUser
MegaEnv.CurrentPassword = strpass
MegaEnv.CurrentProfile=strProf

set myTransaction = MegaEnv.Transactions.create(StrBDD, strUser)
set oMegaRoot = myTransaction.Database.Open

MyDB = oMegaRoot.getCollection("Application").create("APP1")

oMegaRoot.MegaCommit
set oMegaRoot = nothing
myTransaction.Dispatch

Set MegaBase = Nothing
Set Root = Nothing
Set MegaSite = Nothing
Dim oWMIService, colProcessList, oProcess, MegaProcess, bGoodEnd
bGoodEnd = true
MegaProcess = "mgwmapp.exe"
Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colProcessList = oWMIService.ExecQuery ("Select * from Win32_Process")
For Each oProcess in colProcessList
    if oProcess.Name = MegaProcess Then
                               oProcess.Terminate()
                               Wscript.Sleep 1000 '1 sec d'attente
                end if
Next
Set colProcessList = Nothing
Set oWMIService = Nothing