Book a Demo

Author Topic: Can't reliably use EA automation from ASP.Net  (Read 4711 times)

bittercoder

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
  • .Net developer
    • View Profile
Can't reliably use EA automation from ASP.Net
« on: November 14, 2008, 07:30:58 am »
Hi All,

I'm currently writing an ASP.Net 2.0 application which takes advantage of the EA automation interface.

During development we can instantiate an EA.Repository etc. without any issues (using the visual studio.net development web server Cassini) because it's using the currently logged on user.  However when deploying to IIS 6  windows server 2003 this does not work, and instead have to perform some additional DCOM configuration, similar to these previous posts...

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1126651471/7#7

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1191235427/2#2

Here are the steps we're using:
  • Navigate to Control -> Administrative Tools -> Component Services.
  • Navigate to the My Computer -> DCOM Config folder.
  • Locate the EA.App component.
  • Right click and select properties.
  • From the properties dialog select the Security Tab.
  • Click the Customize radiobutton for the Launch & Activate Permissions.
  • Click Edit for the Launch & Activate Permissions.
  • Click Add to add  a new user.
  • Select "Network Service" for the local machine.
  • Give the Network Service "Local Launch" & "Local Activate" Permissions.
  • Repeat for Access Permissions, giving the Network Service "Local Access".
  • Click OK to save changes.
And once we've done that we then need to move to the identity tab and set the component to run with "this user" - supply a valid username and password (in this case we create a specific domain service account for this purpose).

Normally the only caveat with this is you must log on the server at least once with the account you're using to run EA.App, so you can supply a valid EA key.

This has worked fine on a couple of test machines - however we are now finding that "out in the wild" this is not working, and that the repository created by the first call to OpenFile2 hangs indefinitely, anyone have any thoughts on how to resolve this?  

p.s. In some cases we have found that being logged on the server with the service account resolves it too - but only until you log off, at which point asp.net starts hanging again.

Thoughts/suggestions?
« Last Edit: November 24, 2008, 11:15:59 am by bittercoder »

bittercoder

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
  • .Net developer
    • View Profile
Re: Can't reliably use EA automation from ASP.Net
« Reply #1 on: November 24, 2008, 03:30:17 pm »
Managed to resolve this issue (though running multiple instances of EA within ASP.Net for simultaneous access to multiple repositories appears very unreliable).  It turned out to be an oddity with profiles - such that even though we had logged on the server with our service account and provided a license, it was not finding that license when invoking the COM object.

The resolution was to use runas with the following command line:

runas /noprofile /user:<domainname\service account name> "ea.exe -Embedding"

At which point it prompts for the service accounts password, and then displays the EA license dialog - we added the apropriate license - clicked close and then killed off EA.exe from the task manager.  After that everything seemed to work ok without an interactive user being logged into the machine.

Shane

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Can't reliably use EA automation from ASP.Net
« Reply #2 on: December 11, 2008, 03:01:58 pm »
Hi, did you get an answer to this issue.  I have had a similar problem and tried many things.  I wanted to run a C# program I wrote to run the HTML Report directly from Cruise Control.  At the moment I have had to run the job from windows scheduler as a particular user who seems to be able to run the job correctly.  Even if I set up the Cruise Control service as that user it doesn't work.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Can't reliably use EA automation from ASP.Net
« Reply #3 on: December 11, 2008, 11:36:53 pm »
Hi Shane,

Perhaps Cruise Control is just adding a bit of indirection. If EA interprets this too strictly you could have a background problem.

Please note that the following discussion is prefixed with "I'm guessing. Please apply that sentiment throughout as you read on. Remember that I have not tried your configuration myself, so take what I have to say with a grain of salt.

I'm guessing that you are running into yet another variation of the licensing dialog. Windows services cannot have any interaction with the UI. It used to be that some programs simply could not be set up as services, let alone run in that mode. These days it seems that more programs can be installed as services even if they might interact with the UI, only to fail at run time.

Perhaps Windows is starting EA before it impersonates your designated user account, or something like that. EA always asks for a license key the first time it is run under any user account. Even if EA has been set up for all users and successfully activated on that machine, it will ask for a key if you log into a different user account and start EA from there.

So, you probably have to make absolutely sure that you have run EA from the user account that you designate for the service. I suggest you go through this by hand. First create a Windows account with the necessary privileges to run a service. Try running some (any) service application - find one that you can use as a benign trial - from this account, just to ensure that the Windows end of the process is sound. Then run EA by hand from that account and enter a license key. Note that bittercoder used the -Embedding switch. You might want to ensure that you do the equivalent. [Perhaps EA would interpret different invocation methods as different credentials, and ask for a key for each method.]

If you get to that point then you can test whether you can run the EA service at all. Try setting it up to start automatically, then stop and restart it. If that works then try attaching from an external process.

Finally, you are left with the issue of account security. You should take whatever steps are necessary to ensure that 'casual' users cannot log into the service account you are using. The privilege levels would be inappropriate for direct login. [Depending on how you set up the account, it would be either too privileged for general use, or too restrictive for effective use from the desktop. It does not matter which, the account should not be directly accessible to the general user population.]

Let us know,
David
No, you can't have it!

Shane

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Can't reliably use EA automation from ASP.Net
« Reply #4 on: December 12, 2008, 12:20:25 pm »
Thanks for the help.  What I did in the end was set up the Cruise Control service so it runs as a normal user account (a special one for the builds) I then logged on manually and set our shared corporate key for EA to use a UNC path instead of a mapped drive.  It all works fine now.  It's good because if someone checks in a change to the model the docs now get updated automatically.