in Search
 
Home Blogs Forums Marketplace Files
 
 
 

Vista/Alchemy API issue.

Last post 07-18-2008, 9:33 AM by estone. 7 replies.
Sort Posts: Previous Next
  •  07-07-2008, 2:02 PM 14037

    Vista/Alchemy API issue.

    I have been trying to get my Alchemy code to run in Vista and have been bumping into an issue. The architecture consists of a service (I created) that spawns off to a command line program, AlchemyCmd.exe, that talks to Alchemy through interop (Interop.Alchemy.dll).  The problem occurs when the LoadOptionsFile function is called, it throws and error with the message “No valid license”. This code works just fine in XP. Do you have any idea why this is occurring?

    I can call AlhemyCmd.exe from a Vista command prompt and it works properly. It fails when the service tries to spawn to it. The service is running under a user that has rights to execute Alchemy.

    Thanks.

     

    AlchemyCmd.exe C# Code (partial)

    static Alchemy.ApplicationClass app = new Alchemy.ApplicationClass();

     

    try

    {

    Log("Loading options file.");

    app.LoadOptionsFile("");  // failing here

    Log("Loaded options file.");

     

    // more code

    //…  

    }

    catch (Exception ex)

    {

    Log(ex.Message + "\nStack Trace:\n" + ex.StackTrace);

          Console.WriteLine("AlchemyCmd - " + ex.Message);

    }

     

    Log file

    5/1/2008 11:32:04 AM [Info] - Start logging.

    5/1/2008 11:32:04 AM [Info] - RefID: 1b17a27c-eab2-422d-b50e-e10786260c4d

    Loading options file.

     

    5/1/2008 11:32:04 AM [Info] - RefID: 1b17a27c-eab2-422d-b50e-e10786260c4d

    No valid license

    Stack Trace:

       at Alchemy.ApplicationClass.LoadOptionsFile(String Path)

       at AlchemyCmd.Program.Main(String[] args) 

  •  07-15-2008, 11:02 AM 14061 in reply to 14037

    Re: Vista/Alchemy API issue.

    Are you still having issues with this or has it been resolved?

    To see if I could reproduce this, I created a Windows Service that executes a program called AlchemyCmd.exe. The Windows service runs under the local system account and the service was able to execute AlchemCmd which in turn was able to access Alchemy. Have you tried running the service under the local system account?

    Thanks,

    Erin


    Erin Stone
    OpenText Developer Support Engineer
  •  07-16-2008, 7:37 AM 14069 in reply to 14061

    Re: Vista/Alchemy API issue.

    That is interesting. That sound very similar to what I am doing. The only difference that I can see is that I do not log the Windows service under the local system account. Instead, I log the service in as a specific user. This user (say Bob) is the administrator of Alchemy. I do this so I can get the list of databases that Bob has open in the Alchemy Administrator client.

     

    Thanks

     

    Scott.

  •  07-16-2008, 10:19 AM 14071 in reply to 14069

    Re: Vista/Alchemy API issue.

    Scott,

    I was able to reproduce the error in the following manner:

    1. Enable Security on the Server: in the Alchemy Server Console select the Alchemy Server and then right click "Security" and select "Enable"

    2. From another machine running Vista, have service run under local system account (which does not have access to alchemy)

    3. Encountered the "No Valid License" exception.

    So the question I have is do you have "Security Enabled" on the Alchemy Server?  And, for testing purposes,  if you were to disable the security on the server, would you still get the error running the service under user "Bob" or under "Local System"?

    Looking forward to your response.

    Erin


    Erin Stone
    OpenText Developer Support Engineer
  •  07-16-2008, 11:01 AM 14073 in reply to 14071

    Re: Vista/Alchemy API issue.

    I am sorry for not clarifying, I am working with Alchemy Gold…not a server edition.

     

     

    Thanks.

     

    Scott.

  •  07-17-2008, 3:39 PM 14082 in reply to 14073

    Re: Vista/Alchemy API issue.

    Scott,

    I created a Vista system and installed Alchemy Gold.

    1. When I run my application from the command line, it executes fine, creating the Alchemy application instance and logging in.

    2. When I spawn my application from a service (and the service is running under a user account ), the service spawns to the executable, creates the Alchemy application instance and logs in successfully.

    3. When I repeate step 2 and the service is running under the Local System Account, the service spawns the executable, creates the Alchemy application instance and successfully logs in.

    I tried the second scenario above with Vista UAC enabled and disabled and it did not appear to make a difference.The only question I have left for you is how many Alchemy administrator licenses do you have installed -- is it possible some other process is using up your Alchemy administrator license(s) when your service attempts to execute?

    Thanks,

    Erin


    Erin Stone
    OpenText Developer Support Engineer
  •  07-17-2008, 5:40 PM 14083 in reply to 14082

    Re: Vista/Alchemy API issue.

    Interesting. Would it be possible to see your code for the service and the spawned to executable? What language are you working in? I am using C# for the service and the spawned to program.

     

     

    Thanks.

  •  07-18-2008, 9:33 AM 14089 in reply to 14083

    Re: Vista/Alchemy API issue.

    Scott,

    The program is in VB.NET (2005) and the service is in C#(2005). I am using Alchemy 8.2 SP5. The only reason I used VB.NET was because I already had the code written, so it was easy to copy/paste.

    Here is my VB.NET program:

    Module Module1

        Sub Main()
            Dim app As Alchemy.Application
            Dim eventLog1 As System.Diagnostics.EventLog
            eventLog1 = New System.Diagnostics.EventLog()
            eventLog1.Log = "Application"
            eventLog1.Source = "AlchemyCmd"
            Try
                eventLog1.WriteEntry("trying to access alchemy")
                app = New Alchemy.Application()
                eventLog1.WriteEntry("new app created - now load options file")
                app.LoadOptionsFile("")
                eventLog1.WriteEntry("access successful")
            Catch ex As Exception
                eventLog1.WriteEntry("error access alchemy: " + ex.ToString())
            End Try
        End Sub

    End Module

    Here is my C# service code:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.ServiceProcess;
    using System.Text;

    namespace AlchemyService
    {
        public partial class AlchemyService : ServiceBase
        {
            public AlchemyService()
            {
                InitializeComponent();
            }

            protected override void OnStart(string[] args)
            {
                // TODO: Add code here to start your service.
                this.eventLog1.WriteEntry("my service started");
                try
                {
                    this.eventLog1.WriteEntry("trying to start program: AlchemyCmd.exe");
                    System.Diagnostics.Process.Start(@"C:\Visual Studio 2005\AlchemyCMDVB\bin\x86\Release\AlchemyCMDVB.exe");
                    this.eventLog1.WriteEntry("able to start program");
                }
                catch (Exception ex)
                {
                    this.eventLog1.WriteEntry("error logging into alchemy: " + ex.ToString());
                }
            }

            protected override void OnStop()
            {
                // TODO: Add code here to perform any tear-down necessary to stop your service.
                this.eventLog1.WriteEntry("my service stopped");
            }
        }
    }

    If you need anything else, let me know.

    Thanks,

    Erin

     


    Erin Stone
    OpenText Developer Support Engineer
View as RSS news feed in XML
  Privacy    Site Terms   Contact Administrator