Desktop productivity for business analysts and programmers

SAS.Eg.Scripting error when trying to create 2nd instance of Application()

Reply
Occasional Contributor
Posts: 7

SAS.Eg.Scripting error when trying to create 2nd instance of Application()

[ Edited ]

I have a vb.net program using the SAS.Eg.Scripting library.  When I attempt to multi-thread 2 instances of the Application object, the sub with the first instance runs fine however on the second instance, I get the following error:

 

SAS.Eg.Scripting.ScriptingException:
Unable to connect to server: server:port
  at SAS.Eg.Scripting.Application.InitializeEngine()
  at SAS.Eg.Scripting.Application.InitializeBroker()
  at SAS.Eg.Scripting.Application..ctor(String_cmdLineProvider)

 

I'm running SAS EG 5.1 and the code I'm using is along the lines of:

 

Imports SAS.EG.Scripting
Class Example
Sub GetData
Dim taskList = New List(Of Task)
taskList.Add(Sub() RunCode("C:\filename1.egp"))
        taskList.Add(Sub() RunCode("C:\filename2.egp"))
Task.WaitAll(taskList.ToArray)
End Sub
Sub RunCode(fileName as String) Dim egApp = New Application() Dim egProj As ISASEGProject egApp.RunAutoexecFlow = True egProj = egApp.Open(fileName as String, "") 'opens an .egp file that uses AUTOEXEC to run and export code egProj.Close egApp.Quit() End Sub End Class

 

Can anyone offer any suggestions as to why I'm getting the error on the second object?

 

Thanks,

 

Jason

Ask a Question
Discussion stats
  • 0 replies
  • 359 views
  • 0 likes
  • 1 in conversation