HighTechTalks DotNet Forums  

Events lose connection to localhost

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss Events lose connection to localhost in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
John W.
 
Posts: n/a

Default Re: Events lose connection to localhost - 10-08-2007 , 07:46 AM






That helped. Between you and a MS tech, I have been
successfull establishing more impervious connections using
both IPC and a modified TCP (with bindTo and machineName).
Both options work great between two test applications. They
fail miserably, with the same connection loss, between the
"real" application and the service. Maybe I'm close to a
solution, and perhaps not.

"Doug Semler" wrote:

Quote:
BinarySerialization (Level?) = Full on both the client AND server level
serialization methods. This gets around type serialization issues.

IPC communications in .NET 2 gives default access. On XP+ that means that
CREATOR OWNER is the only one that is gonna be able to write to it. you
can get around this by either specifying an authenticationLevel attribute
name (i believe that's the name it may be slightly different....MSDN has the
right one) to the user group of the IPC access. Or, if you are creating the
IPC server/client by "hand" you should be able to specify the acces group.

Remember, an IPC connection type is implemented as a named pipe, which
means it follows the same DACL rules of named pipes.

--
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?


Reply With Quote
  #12  
Old   
John W.
 
Posts: n/a

Default Re: Events lose connection to localhost - 11-02-2007 , 08:53 AM






ANSWER: On the localhost machine, we have to use IPC. The callbacks channel
had to be created in code, but the remoting proxy channel can be configured
in the config file. A key piece was the attribute
authorizedGroup="Everyone", required on both IPC channels.
Since we have other identical remoting connections to other machines, a
TrackingHandler was required to search the ChannelData when an object was
being marshaled and remove the IPC channel from the list when the target is
on a different machine. That is probably the most complicated part. The
rest is very straightforward.

/// <summary>
/// The TrackingHandler is used for customizing a Remoting connection.
/// This one removes references to any IPC channel unless the connecting
/// object has been registered to allow an IPC connection.
/// </summary>
public class IpcTrackingHandler : ITrackingHandler
{
List<object> allowInIpcChannelList = new List<object>();

public void AllowThisInIpcChannel( object o )
{
allowInIpcChannelList.Add(o);
}

// Called when the tracked object is marshaled.
public void MarshaledObject( Object obj, ObjRef objRef )
{
if (!allowInIpcChannelList.Contains(obj) && objRef.ChannelInfo !=
null)
{
List<object> replacementChannelData = new List<object>();
// Copy ChannelData except for any IPC store
foreach (object data in objRef.ChannelInfo.ChannelData)
{
bool okToAdd = true;
if (data is ChannelDataStore)
{
foreach (string uri in
((ChannelDataStore)data).ChannelUris)
{
if (uri.StartsWith("ipc"))
{
okToAdd = false;
break;
}
}
}
if (okToAdd)
replacementChannelData.Add(data);
}
objRef.ChannelInfo.ChannelData = replacementChannelData.ToArray();
}
}

// Called when the tracked object is unmarshaled.
public void UnmarshaledObject( Object obj, ObjRef objRef ) { }

// Called when the tracked object is disconnected.
public void DisconnectedObject( Object obj ) { }
}




Reply With Quote
  #13  
Old   
Spam Catcher
 
Posts: n/a

Default Re: Events lose connection to localhost - 11-02-2007 , 03:39 PM



"Doug Semler" <dougsemler (AT) gmail (DOT) com> wrote in
news:#yjh9KhAIHA.4844 (AT) TK2MSFTNGP02 (DOT) phx.gbl:


Quote:
Yeah I know. We actually redesigned our solution at one point to
specficially avoid remoted events.

Ingo Rammer's book has a good demonstration on how to do remoted
events if you haven't already looked into that.

Sorry, I would help you more but I had four teeth pulled today and am
a bit out of it. If I htink of anything else over the weekend i'll
post.

I used option #2:

http://www.codeproject.com/csharp/RemotingAndEvents.asp

Works great under high volumes too.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.