Issue calling EViews COM Automation from a Windows service

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

perrottg
Posts: 5
Joined: Thu May 08, 2014 3:39 pm

Issue calling EViews COM Automation from a Windows service

Postby perrottg » Sun Aug 03, 2014 8:19 pm

I have developed a Windows service in .NET that uses the EViews COM Automation API to synchronises time series data from our central repository to EViews databases. The intention is that this Windows service is running continuously in the background to ensure the EViews databases are kept in sync with our central time series repository.

During initial testing this worked fine while executing as a Windows console application. However when the application is deployed as a Windows service it only works if a user is currently logged into the PC. As soon as the user logs out, the Windows service starts reporting the following error returned by the EView COM Automation API:

The RPC server is unavailable. (Exception from HRESULT: 0x800706BA).

Is it possible to use the EViews COM Automation from a Windows service without an active user logged into the PC?

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Issue calling EViews COM Automation from a Windows servi

Postby EViews Steve » Mon Aug 04, 2014 8:29 am

Yes, unless you purchased an EViews concurrent license, we do have some restrictions on using it as a service:
  • 1. As a windows service, EViews is restricted to a single instance.
    2. As a DCOM server, EViews is restricted to a single instance.
    3. As a web service, EViews is not allowed to run at all.
A concurrent license does allow multiple instances of EViews to run under all of these scenarios, but each instance uses a license from your license manager.

If you are using .NET or VBA code, make sure you are catching the COM exception and looking at the exception error message manually to see what the actual error message is. If you run into one of the above restrictions, you'll see a related message.

Your "RPC server is unavailable" seems to be a different issue. My guess is that the user account that you are using to run the Windows service does not have proper permissions to run "as a logged in user". Try changing that user account (that is running your Windows service) to an actual user account (like your own) just to see if that resolves the issue. If this is a Windows service (and not a Web service), you should be able to run at least a single instance of EViews without having someone be logged on.

Steve

perrottg
Posts: 5
Joined: Thu May 08, 2014 3:39 pm

Re: Issue calling EViews COM Automation from a Windows servi

Postby perrottg » Mon Aug 04, 2014 3:57 pm

Hi Steve,

Thanks for your response.

I have changed the Windows service to log on as my account. However the Windows service still does not work unless I am also logged into the PC as well.

The actual error reported by EViews is:
GetApplication could not create instance of EViews Application object.

If I log out while the windows service is running then EViews will start returning this error:
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

I am aware of the single instance restriction and that is absolutely fine. The Windows service is intended to be deployed to a dedicated workstation that has no user logged into it.

Greg.

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Issue calling EViews COM Automation from a Windows servi

Postby EViews Steve » Tue Aug 05, 2014 2:12 pm

Greg:

I'm gonna have to try and recreate the issue for you on my machine. I'll respond when I have something...

Steve

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Issue calling EViews COM Automation from a Windows servi

Postby EViews Steve » Tue Aug 05, 2014 3:08 pm

Try this:

1. On the machine hosting EViews, go to Component Services (type in DCOMCNFG.exe in the Windows Run textbox or go to Control Panel->Administrative Tools->Component Services)

2. In the left tree view, go to: Console Root->Component Services->My Computer->DCOM Config
(If you see error messages appear about something being "not recorded", just click NO to continue.)

3. Find "EViews.Application" in the right window. Right-click it and click on Properties.

4. On the Identity tab, you will see that "The interactive user" is selected. Change this to "The launching user". Click OK to save changes.

Now whatever account is being used by your service will also be used by EViews. On my system, when my test service used the "Local System" account, it was able to launch EViews via COM.

Steve

perrottg
Posts: 5
Joined: Thu May 08, 2014 3:39 pm

Re: Issue calling EViews COM Automation from a Windows servi

Postby perrottg » Tue Aug 05, 2014 6:23 pm

Hi Steve,

Thanks again for your quick response.

I have made the change you have suggested and now the Windows service is able to create the EViews.Application object, however subsequent calls to Application.Run fail with this error:
The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
at EViews.IApplication.Run(String commandString)

The command that fails is the command to open a EViews database (i.e. "dbopen databasepath as databasealias").

The Windows service account has full rights to the folder where the databases are located.

This is definitely progress.

Greg.

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Issue calling EViews COM Automation from a Windows servi

Postby EViews Steve » Tue Aug 05, 2014 11:01 pm

Again, you should put a try catch around the call to dbopen, and then report the actual error message being returned by EViews. If the error is something you don't understand, let me know and maybe I can help.

In my test windows service, I just ran the following commands (each with its own RUN call)

create u 10
series x = rnd
series y = rnd
wfsave c:\files\test.wf1

and it worked fine. I also did it with a dbopen call like this:

dbopen c:\files\test.edb as test11
dbrepair c:\files\test.edb
create u 10
fetch x
fetch y
fetch z
wfsave c:\files\test.wf1

And it also worked fine.

Steve

perrottg
Posts: 5
Joined: Thu May 08, 2014 3:39 pm

Re: Issue calling EViews COM Automation from a Windows servi

Postby perrottg » Wed Aug 06, 2014 9:37 pm

Hi Steve,

Yeah do have a try catch block around the call to open the database. The actual exception message is, "The remote procedure call failed. (Exception from HRESULT: 0x800706BE)". The exception occurs when I call Application.Run with the command to open a database.

However, I noticed that my installation of EViews is a little out of date so I have patched to the latest release and guess what....... It WORKS!

Thanks very much with your assistance. Changing the DCOM configuration for the EView.Application was what was required to get it to go.

Thanks again,
Greg.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest