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 ErikC  
#1 Posted : Thursday, June 12, 2014 8:52:45 AM(UTC)
ErikC

Rank: Paid support

Joined: 2/26/2008(UTC)
Posts: 1,437
Netherlands
Location: Amsterdam

Thanks: 95 times
Was thanked: 187 time(s) in 163 post(s)
Hi,

What am I doing wrong here... I try to connect to the VC server with a '.NET code execute' task.

Here is my code:

Code:
public static string test()
{
	Server s = null;
	Client c = new Client();

	Connection conn = new Connection();
	conn.ConnectionType = Connection.ConnectionT.Local;
	conn.UserName = "admin";
	conn.PassWord = "xxx"; 	

	try
	{
		s = c.Connect(conn, true);
	}
	catch (VisualCronAPI.Client.ClientLoginFailedException ex)
	{
		return ex.Message;
	}

	if (s.Connected)
		return "Connected";
	else
		return "Not Connected";
}


Above code returns: Object reference not set to an instance of an object.

When I change the connection to Remote and add an Address and Port to the Connection, the method returns: "Not Connected".

Is it possible to use the .NET code execute task to connect to the local server? When I use the code in an external c# app it works fine..

Regards,
Erik

Edited by moderator Saturday, July 19, 2014 7:12:34 PM(UTC)  | Reason: Not specified

Uses Visualcron since 2006.
Offline ErikC  
#2 Posted : Thursday, June 12, 2014 9:23:16 AM(UTC)
ErikC

Rank: Paid support

Joined: 2/26/2008(UTC)
Posts: 1,437
Netherlands
Location: Amsterdam

Thanks: 95 times
Was thanked: 187 time(s) in 163 post(s)
Hi,

One other thing though...
When I 'test' the task (clicking the RUN button) the task works.
When I run the task from the main window, there is an error:

Exception in Task: Could not load file or assembly 'file:///C:\WINDOWS\TEMP\avl3wt5t.dll' or one of its dependencies. The system cannot find the file specified.

When I look at the referenced dll's, the VisualCron.dll and VisualCronAPI.dll are not in the list anymore. That might be it...

Regards
Erik
Uses Visualcron since 2006.
Offline Support  
#3 Posted : Sunday, June 15, 2014 9:31:03 AM(UTC)
Support

Rank: Official support

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

Thanks: 573 times
Was thanked: 326 time(s) in 314 post(s)
Just that kind of code does not mix well with running from the Client. The reason is that we use static references to events in the Client which reacts on various connection events.

There are some problems running this server code right now. I think the best workaround is to use the Assembly Task or Execute Task. But in the future we will separate execution from main VisualCron assemblies in this .NET Code Task just as in the Assembly Tasks.
Henrik
Support
http://www.visualcron.com

Please like VisualCron on facebook!
Offline ErikC  
#4 Posted : Monday, June 16, 2014 7:16:39 AM(UTC)
ErikC

Rank: Paid support

Joined: 2/26/2008(UTC)
Posts: 1,437
Netherlands
Location: Amsterdam

Thanks: 95 times
Was thanked: 187 time(s) in 163 post(s)
Hi,

argghhh.. I thought this was a nice solution. Not having to rebuild my app every time when there is a new version. This way I always use the latest VC dll's... but no..

I'll make an external app in the meantime. But I think the error should be handled if we try to do this so we know it's not possible (for now BigGrin)

Regards,
Erik
Uses Visualcron since 2006.
Offline Support  
#5 Posted : Monday, June 16, 2014 8:41:53 AM(UTC)
Support

Rank: Official support

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

Thanks: 573 times
Was thanked: 326 time(s) in 314 post(s)
Unfortunately, it is a lot at the core of the Client concerning connections, list of jobs and Tasks. We are very careful about breaking things that work right now.
Henrik
Support
http://www.visualcron.com

Please like VisualCron on facebook!
Offline ErikC  
#6 Posted : Monday, June 16, 2014 9:50:23 AM(UTC)
ErikC

Rank: Paid support

Joined: 2/26/2008(UTC)
Posts: 1,437
Netherlands
Location: Amsterdam

Thanks: 95 times
Was thanked: 187 time(s) in 163 post(s)
Clear for me,

I just made an external c# application and this works fine now.


Just to let you know what I build:

My program checks if there are inactive triggers on active jobs.
This result is matched with a whitelist and if there is a trigger which should not be disabled it throws an error.
With the error I inform my people over here to act accordingly.


Regards,
Erik
Uses Visualcron since 2006.
thanks 1 user thanked ErikC for this useful post.
Support on 6/16/2014(UTC)
Offline Support  
#7 Posted : Saturday, July 19, 2014 7:12:16 PM(UTC)
Support

Rank: Official support

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

Thanks: 573 times
Was thanked: 326 time(s) in 314 post(s)
Hi Erik,

we have made some changes in the latest beta to avoid conflicts with using the .NET Code Task to connect locally. Please test it here:

http://www.visualcron.co...sts&t=4259#post18862
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.277 seconds.
Scroll to Top