Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


mdawson
2014-02-06T21:27:11Z
I'm trying to write a .NET script task loop through jobs, loop through triggers for each job, and activate Event type triggers. Our File triggers deactivate a lot.

Here's a simple script as a start point, simply returning a list of jobs and their triggers. I added the references to the two VC dlls and the using statements. It compiles, and when I hit Run, I get this error: "An error occurred: Object reference not set to an instance of an object." Ive isolated it down to the server not being instantiated, so apparently it's the Connect(). What other commands or parameters am I missing?


        public static string ListJobsAndTriggers()
        {
            var client = new Client();
            Connection conn = new Connection();
            conn.ConnectionType = Connection.ConnectionT.Local;
            var server = client.Connect(conn, true);
            var jobs = server.Jobs.GetAll();

            List<string> result = new List<string>();
            foreach (var job in jobs)
            {
                result.Add("Job: " + job.Name);
                foreach (var trigger in job.Triggers)
                {
                   result.Add(" - Trigger: " + trigger.Description);
                }
            }

            return string.Join(@"\r\n", result.ToArray());
        }


Sponsor
Forum information
Support
2014-02-06T21:39:33Z
Have you tested and compared it with the sample API project (in c#) in the API folder?

About trigger deactivation. Try increasing the retry times and retry interval.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-07T15:45:38Z
I'll try the reconnect settings (hmmm, didn't see them there). What is the option Ignore Server Off (always run) for?

The code (lines 3-6) was taken from the sample, but doesn't seem to work for me. I haven't tried from with VisualStudio because I want this to run as a script task and VC isn't installed on my dev machine.

Support
2014-02-07T15:53:10Z
Ignore server off lets a Trigger be active even the Server is in stopped/off state.

Make sure you are using the exact same version of dlls as the server.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-07T16:36:35Z
Thanks for the clarification. I bumped up the reconnect settings to 500 attempts (the max) and 300secs between. We'll see how this works out.

VS and the script task are both referencing the DLLs in the server installation folder. I looked at the sample TestClient\frmTest.cs again. I used the code in btnConnectLocal_Click() for a local connection. VS builds and the script task compiles in VC, so I'm assuming the code itself is ok, so it seems something else is wrong as I'm not getting a server instance from Connect() in the script task.

Any thoughts?
Support
2014-02-10T08:27:55Z
But is the sample project working for you?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-26T17:59:50Z
I finally got around to this. I increased the retry times and period on all the file triggers and so far so good.

Concerning my API connection issue, the sample test project can connect to localhost, but the remote server connection fails with the message "A connection attempt failed because the connected party did not properly respond..." The debugger is sitting at line 176 in frmTest.cs

            conn.ConnectionType = Connection.ConnectionT.Remote;
            try
            {
                // connect - which returns a Server object
                s = c.Connect(conn, true);
            }


The VC tray client won't connect either, by neither IP nor Name.

What could the problem be?
Support
2014-02-26T22:11:17Z
Probably a firewall. You can test this with telnet:

telnet remotehostname 16444

16444 is the port that needs to be open.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top