473,394 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Activator.GetObject Method (Type, String)


This method does not fail if the site is not running! Is there a way to
check the proxy for failure?
Thanks
Tom
Jul 16 '06 #1
5 8650
Tom,

What do you mean if the site is not running? Can you post an example?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ne***************@charter.netwrote in message
news:%W*************@fe07.lga...
>
This method does not fail if the site is not running! Is there a way to
check the proxy for failure?
Thanks
Tom

Jul 16 '06 #2
ne***************@charter.net wrote:
>
This method does not fail if the site is not running! Is there a way to
check the proxy for failure?
Thanks
Tom
Hi Tom,

Are you talking about remoting? Can you provide a code sample?

--
Hope this helps,
Tom Spink

Google first, ask later.
Jul 16 '06 #3
Yes

// start the process to talk to
Process TrackersProcess = Process.Start(@"some good thing to starg",
TrackerBuilder.ToString());

// set me up to send
ClientChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(ClientChannel, true);
WellKnownClientTypeEntry remoteType = new
WellKnownClientTypeEntry(typeof(MTGClassLibrary.MT GTracksMessage),
TrackerURL);
RemotingConfiguration.RegisterWellKnownClientType( remoteType);

// here is the example

MessageTracker = (MTGTracksMessage) Activator.GetObject
(typeof(MTGClassLibrary.MTGTracksMessage), TrackerURL);

If I comment out the start process the GetObject still works.
Jul 16 '06 #4
ne***************@charter.net wrote:
Yes

// start the process to talk to
Process TrackersProcess = Process.Start(@"some good thing to starg",
TrackerBuilder.ToString());

// set me up to send
ClientChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(ClientChannel, true);
WellKnownClientTypeEntry remoteType = new
WellKnownClientTypeEntry(typeof(MTGClassLibrary.MT GTracksMessage),
TrackerURL);
RemotingConfiguration.RegisterWellKnownClientType( remoteType);

// here is the example

MessageTracker = (MTGTracksMessage) Activator.GetObject
(typeof(MTGClassLibrary.MTGTracksMessage), TrackerURL);

If I comment out the start process the GetObject still works.
This is by design. Activator.GetObject
does not actually connect, it only returns proxy object. Connection is
established at the moment first remote call is made ("lazy connect").
That was bad desing decision IMHO, but it is as it is. You could
implement dummy method ("Ping()") on your remote object on which you can
check (and force) connection.

Regards,
Goran
Jul 16 '06 #5
That was the way I read it but I often miss the obvious.

Thanks
Jul 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: rlum | last post by:
I have a remoting app that calls a windows service using the Activator.GetObject(type, url). works great with studio 2002 and framework 1.0. However I upgraded to 2003 and 1.1. Now it dosen't...
2
by: shmeian | last post by:
I have the following code which works fine. However I want to pass the object I'm instantiating a string for its constructor. I can't get the syntax right. Can someone give me an example of...
26
by: CKR Rajesh | last post by:
Hi, I have 2 dlls on which i have the same class MyClass defined. Say A.dll and B.dll The classes have a function (but different functionality) void f(); I use .Net late binding using...
7
by: hazz | last post by:
this is a repost with more concise code (well, for me) and better questions (I hope....) . given the following two classes, my intent is to use either Activator.CreateInstance or InvokeMember pass...
3
by: System.Reflection Activator | last post by:
************************************** //Load the Assembly Assembly a = Assembly.LoadFrom(sAssembly); //Get Types so we can Identify the Interface. Type mytypes = a.GetTypes(); BindingFlags...
1
by: mkadlec99 | last post by:
Hi, I have a Windows Service written in C# that gets an object via Remoting using the Activator.GetObject() and then calls a method on it. When called via .NET apps, everything works great. I...
0
by: Jules Winfield | last post by:
I have a singleton object that's accessed via remoting by way of Activator.GetObject(): SomeObject someObj=(SomeObject)Activator.GetObject(typeof(SomeObject),someUrl); My question is: Is the...
0
by: Jon Skeet [C# MVP] | last post by:
On Apr 11, 8:40 am, Andrew <And...@discussions.microsoft.comwrote: Okay, that means you've either not given the full classname (including namespace) or it's not in mscorlib or the currently...
0
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Found it. string name = Properties.Settings.Default.ClassName.ToString(); //"myproject.myclass, myassembly" format. //name = "ABC.MyClass, Assem" ; Type t = Type.GetType(name); Object obj...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.