Postby EViews Steve » Fri Jan 13, 2017 9:58 am
Actually, let me be a bit more clear.
Our normal EViews license DOES allow you to run EViews under a Windows service, but only a single instance is allowed to run that way. This allowance was mainly made because this type of scenario is typical if you're calling 64-bit EViews from a 32-bit process or vice-versa (which Windows handles via Distributed COM, a hosted process).
Now your particular error doesn't seem to caused by this kind of cross-bitness situation because your error message doesn't mention 'DCOM' -- instead it mentions 'windows service'. So in your case, EViews is detecting that the calling process is an actual Windows service and that there is already a different instance of EViews already running.
If you'd like help figuring out why EViews is detecting the calling process as a windows service, let me know.
If you need to keep running your script as a windows service, then you'll be limited to a single instance. You might change your GetApplication call to say GetApplication(1) (1 means new or existing) so that if EViews is already running somewhere, the script will use that instead of creating a new one each time.
If you're confused because you don't think there is another instance of EViews already running, COM Automation scripts are notorious for orphaning COM references which leads to hidden instances of the host program (EViews, in this case) still running in the background forever. To check for this, run the Windows Task Manager, click on the Processes tab, click on the "Show processes from all users", then check the list of processes for an EViews process. If you see one, simply right-click it and select "End Process". Once it's all clear, try your script again.