473,836 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with .NET Remoting

Hi everyone,

i have the following problem:

i got a host-gui which hosts a server-object with infinte lifetime. This
server creates 5 agent-objects (also marshal-by-ref) with a limited lifetime
of 10 sec and a RenewOnCallTime of 2 sec.
Unfortunately those agent-object are not disconnected as expected after 10
sec! The lifetime is even set back to 10 sec. all the time...
Furthermore the InitializeLifet imeService method is evidently not called
directly...if I call agent.GetLifeti meService() immediately after the
creation of an agent-object it returns null, what is not what one should
expect...

I hope someone could help me...Thanks for every mail!

Here is a code-snippet:

public class HostGUI : System.Windows. Forms.Form
{
public HostGUI()
{
InitializeCompo nent();
this.server =
(Services.Serve r)Activator.Get Object(typeof(S ervices.Server) ,
http://localhost:1234/Server.soap);
}

static void Main()
{
IDictionary props = new Hashtable();
props["typeFilterLeve l"] = "Full";
SoapServerForma tterSinkProvide r formatterProvid er = new
SoapServerForma tterSinkProvide r(props, null);
HttpServerChann el chnl;
chnl = new HttpServerChann el("ServerChann el", 1234,
formatterProvid er);
ChannelServices .RegisterChanne l(chnl);
RemotingConfigu ration.Register WellKnownServic eType(typeof(Se rvices.Server),
"Server.soa p", WellKnownObject Mode.Singleton) ;
Application.Run (new HostGUI());
}
}

public class Server : MarshalByRefObj ect
{
public Server()
{
agents = new HybridDictionar y();
agentSponsors = new HybridDictionar y();
InitAgents();
}

public override object InitializeLifet imeService()
{
return null;
}

public void InitAgents()
{
Agent agent;
for(int i = 0; i < 5; i++)
{
agent = new Agent(i);
if(!agents.Cont ains(agent.Id))
agents.Add(agen t.Id, agent);
ILease lease =
(ILease)Remotin gServices.GetLi fetimeService(a gent);
if(lease != null)
{
//doSometing
}
else
{
//doSometingElse
}
}
}
}

public class Agent : MarshalByRefObj ect
{
public override object InitializeLifet imeService()
{
ILease tmp = (ILease)base.In itializeLifetim eService();
if(tmp.CurrentS tate.Equals(Sys tem.Runtime.Rem oting.Lifetime. LeaseState.Init ial))
{
tmp.InitialLeas eTime = TimeSpan.FromSe conds(10);
tmp.RenewOnCall Time = TimeSpan.FromSe conds(2);
}
return tmp;
}
}
Nov 17 '05 #1
0 1107

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

Similar topics

0
2932
by: Sean Newton | last post by:
I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security assemblies. I've been trying to set these up in a very straightforward harness in the way that I'd like to be able to use them. No IIS. Use TCP, binary. Standard server example with a console host and console client. .NET 1.1, windows XP. (I tried posting to the remoting newsgroup, no answers in the last couple days, trying here in hopes that more people watch this...
15
4003
by: anders | last post by:
Hi! I have a config file that looks like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.runtime.remoting> <application> <service> <wellknown mode="SingleCall" type="Interfaces, IMyFirstRemotableObj" objectUri="ControlCenter" /> </service>
0
948
by: Mike Peretz | last post by:
I don't know why, but for some reason exception do not serialize correctly when they hold a typed dataset. I have added code to serialize the dataset, but still when it gets to the other appDomain, half of it is missing. Is there a bug with remoting and serializing datasets or typed datasets? Is there a problem serializing typed datasets with remoting? is there an issue with Exceptions and remoting?
0
1028
by: Pushpendra | last post by:
Hi, I have created 2 dlls (Irefdata.dll, RefdataServer.dll) and one remoting service RefDataService.exe. Irefdata is ainterface and I have implemented this interface in refdataserver. I have referenced Irefdata & Refdataserver in the service (Refdataservice.exe) so that I can register this service on tcp channel and access the methods of refdataserver. If I reference these dll without deplying these in global assembly cache (means copy...
0
883
by: Jeremy B. | last post by:
I am an engineering student new to Visual Basic.Net programming. I am remoting to Excel from a Windows form and I am having some problems when I run my application on a computer that has a different version of Excel than what I have. I am working with Excel 2003 (referencing 11.0 object library) and when I run it on a computer with Excel 2000, it throws the following error message.. "File or assembly name Microsoft.Office.Interop.Excel, or...
8
1757
by: Raju Joseph | last post by:
Hi All, I am just trying to get an opinion here. I know this is always a tough choice to make. We are in the process of converting our VB6 based Healthcare Information System (a full-fledged package) to .NET. Our clients have been asking for lot of new stuff namely being able to send patient information to devices, being able to fix appointments online, etc.
0
992
by: tomaszh | last post by:
Hello, We are having a problem transfering large amounts of data ( > 3MB) over remoting. The problem only seems to occur when data is transfered from the client to server, as we have successfully transfered ~23MB of data from server to the client using the same method. We are using a DataTable with several columns where one of them is holding a byte array to transfer files. Remoting settings: using WellKnownObjects available via IIS,...
3
4949
by: =?Utf-8?B?ZmFpcnl2b2ljZQ==?= | last post by:
we know that if the type is registered as singleton in the host side, then all the remoting clients share one object, like: host: ===== TcpServerChannel chn = new TcpServerChannel(9999); ChannelServices.RegisterChannel(chn,true); RemotingConfiguration.RegisterWellKnownServiceType(typeof(SomeClass), "someclass",WellKnownObjectMode.SingleCall); ========
2
3060
by: erbilkonuk | last post by:
Hi, I am very new to .NET Remoting and I try to run a simple program to subscribe to an event raised by Remoting Class. The Remoting Server initiates an instance of Remoting Class as Singleton / Server activated mode on startup. The Remoting Client accesses the Remoting Class through the interface of the Class and subscribes to an event of the Remoting Class that will be fired upon the private member value change.
0
3406
by: Kristian Reukauff | last post by:
Hi I have a problem with the .Net-Securty-Functions. I've got a client and a server. When I try to register a channel at the server with this line: ChannelServices.RegisterChannel(chan, false); I get the following error - doesn't matter if I try it local from my machine or from a remote machine. (After the Errormessage is more text ;))
0
9818
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9668
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10843
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10546
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10589
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5648
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4015
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.