.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Raise Events in remoting object

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :WPF

Hello i m new to .Net Remoting and I have following scenario and don't know how to deal with event raised on service side and handled on client side.

My remote object starts controller and controller further starts scheduler

Scheduler is responsible for scanning all jobs in queue and adding more jobs in a queue.

Queue member raises an event which i want to handle on client side

Could anyone help me to get solution for this


View Complete Post

More Related Resource Links

.NET Remoting Problem with Sponsor Renewal on CAO (Client Activated Object) Architecture

I have figured out a strange behaviour when using Client Activated Sponsorship and hope to get a hint from somebody who already got in touch with similar problems. The case is as follows: An Application is used by a server and a client. Both use (or try to use) the same objects after a user login. A lease of a session object on the server (serverSession) is initialised correctly with all of its regular remoting values in the lease for InitialLeaseTime (10) SponsorshipTimeout (5) RenewOnCallTime (10) In order to test the behaviour the values are set to seconds. It is easier to check the log every few seconds, than to wait some minutes until the Sponsorship Renewal call. If a client performs a login, the lease is according to its logged in state renewed each 10 seconds (or whatever the value is set to). So no problem so far. The lease will be alive as long as the client performs a logout, by the way it is used on a local network. Just compare the log (the renewal is firing every 10 seconds as expected): 2010-02-17 10:29:40.4338 Info Log5 SponsorObject:Renewal() 2010-02-17 10:29:50.4308 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:00.4328 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:10.4298 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:20.4318 Info Log5 SponsorObject:Renewal() 2010-02-17 10:30:30.4288 Info Log5 SponsorObject:Renewal() As soon as

Stream object is inaccessible after returning from remote layer through remoting -


In my export function I am returning the System.IO.Stream object from remote layer through remoting. But getting the stream object it becomes inaccessible when I called the remoting layer with integrated authentication. It is giving me The remote server returned an error: (401) Unauthorized exception even I access its CanRead or CanWrite property. This is happening only in case of integrated authentication. For without any authentication its working fine.

 Dim ostream As System.IO.Stream
                        oWriter.WriteLine(Now & " - Before calling GetExportData")
                        ostream = oExport.GetExportData(dsGrid, intDateType, repPage.m_strFromDate, repPage.m_strToDate, repPage.m_strProcessStatus, repPage.m_strLocation, repPage.m_strDiseaseOrGrouping, repPage.m_strDiseaseOrGroupingDR, repPage

Automatically generated wrapper for COM object handles all events!



I have a COM-object, and use it in my app.

COM object raises many events and my app subscribed on some of this events.

When I create this COM-object, my app loads the processor on 50%.

I'm traced it with profiler and found that the processor is loaded by processing of events on which I didn't subscribe!

Than I make a conclusion that .NET processes all events of COM object, and if my app is subscribed - raises my handlers.

How I can disable subscribing on all events?? Or how I can generate Interop dll without events that i don't want to process?

Using IPC only channel getting Unable to cast object of type 'System.Runtime.Remoting.Identity' to


I have a remoting application that is using delegates to preform callbacks between processes. I found that if I don't use a TCP channel at all and only initialize an IPC channel that the callback delegates start throwing the following error after about a minute has passed.

From what little I could find on Google it seems to be a Lifetime Service management issue but all the classes that the delegates belong to return null from InitializeLifetimeService which should give the object an infinite lifetime.

With the TCP channel initialized the issue doesn't happen, but I would like it to use the IPC channel if all of the processes are on the local box.


Type:        System.InvalidCastException
Message:    Unable to cast object of type 'System.Runtime.Remoting.Identity' to type 'System.Runtime.Remoting.ServerIdentity'.
Stack Trace:   
Server stack trace:
   at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI)
   at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)


Vb.net remoting Error while registering the events on clients.?

i m getting the following error while registering the events on clients.
"An error occurred creating the form. See Exception.InnerException for details. The error is: Exception has been thrown by the target of an invocation."

'My Coding
Dim chan As HttpChannel
Dim serverProv As New BinaryServerFormatterSinkProvider
Dim clientProv As New BinaryClientFormatterSinkProvider
Dim props As IDictionary = New Hashtable
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.…
props("port") = 0
'props("name") = "ChatApplication"
chan = New HttpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(chan, False)

theManager = CType(Activator.GetObject(Type.GetType("… "http://localhost:7777/ChatApplication")… InBetween.Manager)

AddHandler Me.theManager.evtReceiveText, Addre

Remoting and events



I have a problem to solve that I am sure many others have solved before me. I would like to hear how you have solved it, and what the pros and cons are versus other alternatives.

The problem is this: An entity in a client-server application is to be modified by the server, but the client needs to take action in response to the changes. Ideally I would like the entity object to offer events that can be subscribed to whether on the server or on the client.

We are using remoting, so particulars may apply, although in general the problem of course comes from the client-server nature of the system.

I am unsure if making use of two-way remoting is the way to go. I am not (at least not yet!) talking about pushing changes from one client to another. Rather, a client provides an entity object, the server updates it, and the SAME client responds to changes in its state. It seems to me I would need some kind of "deferred" event firing mechanism, and I suppose I could implement this in my entity objects. Perhaps put event information in a queue when normally one would raise the event, so they can be raised later instead.

If anyone has any ideas or in paritcular *experience* with solutions to this problem, I'd be very interested to hear your POVs.

Observer pattern via remoting and events


I have a remote object, using the observer pattern, that calls a NOTIFY method on the registered client that in turn displays a message box with the message being sent by  the other clients.  All works fine.  My question is this - I would like the NOTIFY method on the registered client to trigger a client side event, instead of displaying a messge box.  However whenever I change to triggering an event within the NOTIFY method it seems to hang the entire client application. Why is this?  Any help would be appreciated. Below is a sample of the client side code called via remoting from server.

        public static GlobalEventListener<LockChangeArg> gel = GlobalEventListener<LockChangeArg>.Instance;
public void Notify(object anObject)         {   &nb

Remoting, CAO, destruction of Object - How ?


This question is in reference to the article at


broker CAO using factory pattern.


I'm not able to get the destructor called for the CAO, unless the remoting server is stopped.

Is it because the object implemented using factory and the reference to the object becomes anonymous??


I have also tried for override the method "InitializeLifetimeService"


 public override object InitializeLifetimeService()
      ILease lease = (ILease)base.InitializeLifetimeService();
      if (lease.CurrentState == LeaseState.Initial)
        lease.InitialLeaseTime = TimeSpan.FromSeconds(1);
        lease.RenewOnCallTime = TimeSpan.FromSeconds(1);
        lease.SponsorshipTimeout = TimeSpan.FromSeconds(0);
      LifetimeServices.LeaseManagerPollTime = TimeSpan.FromSeconds(1);
      LifetimeServices.LeaseTime = TimeSpan.FromSeconds(2);
      LifetimeServices.SponsorshipTimeout = TimeSpan.FromSeconds(2);

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

WCF Tutorial - Events and Callbacks

we described how to make a very simple client/server application where clients would call functions on the server through a shared interface. In this tutorial, I'm going to expand that application to allow the server to execute functions on the client by using callbacks. Essentially, this is WCF's mechanism to allow events to be raised from the server to it's connected clients.

C# Object Oriented Programming

So far in C# Essentials we have looked at the basics of programming in C# such as variable types and flow control. Although it would be possible to write a functional program using these techniques, there is much more to becoming a proficient C# programmer. C# is, above all, an object oriented programming language and as such any C# programmer will be expected to create object-oriented applications using this language.

Object Oriented Programming

Four core concept of OOP Object Oriented Programming. 1.Inheritance, 2.Polymorphism, 3.Abstraction and 4.Encapsulation

Object-Oriented Programming Concepts

This is the first in a series of articles describing the use of object-oriented programming techniques as implemented by the C# programming language. This series follows the C# Fundamentals tutorial that beginners are advised to read first.

Overview of SharePoint Object Model

SharePoint offers a set of structured server-side objects those are widely used to program SharePoint Applications. These objects are hierarchically arranged and you can drill down through the object hierarchy to obtain the object that contains the components of SharePoint Application you need to use in your code.

What is the difference between "dynamic" and "object" keywords?

Let's take a quick look at the object keyword first. I'm not going to talk a lot about it because it's been around since C# 1.0. This keyword is nothing more than a shortcut for System.Object, which is the root type in the C# class hierarchy. (However, as Eric Lippert pointed out in his blog post, not everything in C# derives from object.) This is a powerful mechanism, since you can assign almost any value to instances of this type.

Delegates and events in c#.net

People often find it difficult to see the difference between events and delegates. C# doesn't help matters by allowing you to declare field-like events which are automatically backed by a delegate variable of the same name. This article aims to clarify the matter for you. Another source of confusion is the overloading of the term "delegate". Sometimes it is used to mean a delegate type, and at other times it can be used to mean an instance of a delegate type. I'll use "delegate type" and "delegate instance" to distinguish between them, and "delegate" when talking about the whole topic in a general sense.

How to bind GridView and DropDownList controls using DataTable object

In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend