Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline mdawson  
#1 Posted : Thursday, February 6, 2014 10:27:11 PM(UTC)
mdawson

Rank: Paid support

Joined: 6/25/2013(UTC)
Posts: 22
United States

Was thanked: 1 time(s) in 1 post(s)
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?

Code:

        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());
        }


Offline Support  
#2 Posted : Thursday, February 6, 2014 10:39:33 PM(UTC)
Support

Rank: Official support

Medals:
Joined: 2/23/2008(UTC)
Posts: 9,412

Thanks: 573 times
Was thanked: 326 time(s) in 314 post(s)
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!
Offline mdawson  
#3 Posted : Friday, February 7, 2014 4:45:38 PM(UTC)
mdawson

Rank: Paid support

Joined: 6/25/2013(UTC)
Posts: 22
United States

Was thanked: 1 time(s) in 1 post(s)
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.

Offline Support  
#4 Posted : Friday, February 7, 2014 4:53:10 PM(UTC)
Support

Rank: Official support

Medals:
Joined: 2/23/2008(UTC)
Posts: 9,412

Thanks: 573 times
Was thanked: 326 time(s) in 314 post(s)
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!
Offline mdawson  
#5 Posted : Friday, February 7, 2014 5:36:35 PM(UTC)
mdawson

Rank: Paid support

Joined: 6/25/2013(UTC)
Posts: 22
United States

Was thanked: 1 time(s) in 1 post(s)
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?
Offline Support  
#6 Posted : Monday, February 10, 2014 9:27:55 AM(UTC)
Support

Rank: Official support

Medals:
Joined: 2/23/2008(UTC)
Posts: 9,412

Thanks: 573 times
Was thanked: 326 time(s) in 314 post(s)
But is the sample project working for you?
Henrik
Support
http://www.visualcron.com

Please like VisualCron on facebook!
Offline mdawson  
#7 Posted : Wednesday, February 26, 2014 6:59:50 PM(UTC)
mdawson

Rank: Paid support

Joined: 6/25/2013(UTC)
Posts: 22
United States

Was thanked: 1 time(s) in 1 post(s)
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
Code:

            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?
Offline Support  
#8 Posted : Wednesday, February 26, 2014 11:11:17 PM(UTC)
Support

Rank: Official support

Medals:
Joined: 2/23/2008(UTC)
Posts: 9,412

Thanks: 573 times
Was thanked: 326 time(s) in 314 post(s)
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!
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2016, Yet Another Forum.NET
This page was generated in 0.335 seconds.
Scroll to Top