Problem with Ingo's EventsEnhanced sample

dotnet framework

    Sponsored Links

    Next

  • 1. Server availabililty
    Hello, Is there a way the Client can ask the Framework whether the Server is started/running, without the use of a Try-Catch ? Thanks, victor
  • 2. Could not find schema information for the ...
    I transistioned from XP to Vista recently and my current project suddenly had several messages concerning "Could not find schema information for the..." from my remoting config file. There really is no big deal with it it is more annoying than anything else but I am one who likes to have my builds clear of all Errors, Warnings and Messages whenever possible and am just wondering if there is a fix for this or what I am doing wrong. A following is a list of the missing schema information. Could not find schema information for the element 'applicaton' Could not find schema information for the element 'client' Could not find schema information for the attribute 'displayName' Could not find schema information for the element 'wellknown' Could not find schema information for the attribute 'type' Could not find schema information for the attribute 'url' Could not find schema information for the element 'channels' Could not find schema information for the element 'channel' Could not find schema information for the attribute 'ref' I'm running .net 2.0 on VS2005. I had installed the Windows SDK (.net 3.0) on XP and have reinstalled it on vista. I'm wondering if I'm missing some kind of a reference or something. Any help on this matter would be creatlye appreciated, thank you. ~Justin

Problem with Ingo's EventsEnhanced sample

Postby Q2luZHkgTGl1 » Wed, 13 Oct 2004 03:47:08 GMT

Hi,
 
I have downloaded Ingo's EventsEnhanced sample and did the following 
modification:
In General.cs:
1. Add a serializable class:
	[Serializable]
	public class MyClass
	{
		public string _str;
		public string MyString{get { return _str;} set {_str=value;}}
		string _private;
		public string ReadOnly{get {return _str;}}
                }
2. Modified the delegate to:
	public delegate void MessageArrivedHandler(String msg,MyClass oClass);

In Server.cs:
Modified SafeInvokeEvent to print out MyClass.MyString.

I have no problem to run the modified samples on my Windows 2003 Server box. 

However, after I add the strong name for General.dll (I haven't put it in 
GAC and didn't change any configuation files either), I ran server.exe, no 
problem. Then ran EventListener.exe, no problem. Then ran EventInitiator.exe, 
no problem with itself, but the server.exe console showed 

"Number of Listeners: 1. Exception occured, will remove Delegate. Because of 
security restrictions, the type General.MyClass cannot be accessed. InnerErr: 
Request failed." 

I modified his code to print out error message and inner error message. 
Anybody has idea why?
 
Thanks in advance!!!
Cindy


Similar Threads:

1.Can't run Ingo's Compression Sink sample

I've tried both the older version, and the one for the edition of the
book, and i get the same error.  I sent to a coworker, and he has the
same error, som it's not just my machine (which was my first thought).

Exception :

An unhandled exception of type 'System.Exception' occurred in
mscorlib.dll

Additional information: System.ArgumentOutOfRangeException: Number was
less than the array's lower bound in the first dimension.
Parameter name: dstIndex
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array
destinationArray, Int32 destinationIndex, Int32 length)
   at NZlib.Streams.OutputWindow.CopyOutput(Byte[] output, Int32
offset, Int32 len)
   at NZlib.Compression.Inflater.Inflate(Byte[] buf, Int32 off, Int32
len)
   at NZlib.Streams.InflaterInputStream.Read(Byte[] b, Int32 off, Int32
len)

Help?

-Andy

2.Ingo Rammer's sample Code

Make sure that the server.dll is copied in the clients bin directory as 
well.

Sunny


In article < XXXX@XXXXX.COM >, 
 XXXX@XXXXX.COM  says...
> Hi there everyone,
> 
> Has anyone downloaded and been able to get Ingo's code in the last part of
> chapter 6 of his book "Advanced .NET Remoting" to work?
> 
> I am having an exception problem in the EventListener class (p.194).
> System.IO.FileNotFoundException: File or assembly name Server, or one of its
> dependencies, was not found.   This is the same error as was given in the
> previous example, and was supposed to be solved in the revised code.
> 
> I have changed all the mains(string[] args) to public constructors because I
> am running the classes inside another class. One VS.NET C# solution for the
> server and one for the client.  I also have all the ports set to
> IPADDRESS:8080.
> 
> with regards
> James
> 
> 
> 
> 

3.Race condition in Ingo's Transport Sink

First of all, I think Ingo Rammer's book, "Advanced .NET Remoting" is
an invaluable resource for making your own custom channel sinks (and
understanding the real problems of .NET Remoting in general).

Looking at the synchronous request logic for the SMTP example
transport sink, though, I think I see a possible race condition.


// send the message
SMTPHelper.SendRequestMessage
(_senderEmailAddress,email,_smtpServer,requestHeaders,requestStream,objectURI,
out ID);

// ((( response could come before we get into Wait... )))

// wait for the response
POP3Msg popmsg = SMTPHelper.WaitAndGetResponseMessage(ID);


...if you follow those on down, you'll see that
WaitAndGetResponseMessage() does a
Thread.GetCurrentThread().Suspend(), and a fn called MessageReceived()
does a Resume() on that thread

The race (inasmuch as there can be a race with an e-mail transport) is
between the sender getting to the Suspend() and the response coming
back.  If the response comes back before the waiter gets into
Suspend(), then the Resume() will throw (and the requesting thread
will hang for ever once it *does* get to Suspend()).

While this probably never happens in his SMTP sink, it could very well
happen in a custom channel where the response can come back very
quickly.

Some moderate rearranging would have to be done to plug that gap.

4.Ingo's RemotingHelper

I was really excited to see Ingo's RemotingHelper class. 
It allowed me to use RemotingConfiguration with interfaces
and do away with my own configuration (almost).

RemotingConfiguration (understandably) does not allow the
following;

<system.runtime.remoting>
   <application>
      <channels>
         <channel ref="tcp" port="0" />
      </channels>
      <client>
         <wellknown 
            type="RemotingHelperDemo.ICompute, DemoInterfaces"
            url="tcp://localhost:5556/Foo"
         />
         <wellknown 
            type="RemotingHelperDemo.ICompute,
DemoInterfaces"  
            url="tcp://localhost:5556/Bar"
         />
      </client>
   </application>
</system.runtime.remoting>

I'm thinking about adding RemotingConfiguration
functionality to RemotingHelper (e.g. a Configure method
that would know how to handle above config file).  Then I
could implement another GetObject with the following signature;

public static Object GetObject( string uri )

One would have to make certain decisions, like what would
this do given the above config file;

RemotingHelper.GetObject( typeof( ICompute ) );

You could have it throw an exception since typeof( ICompute
) doesn't uniquely identify a remote object, or you could
return the first/last one.

I dunno...

5.Ingo's book CAO example Question

6. Problem with running Ingo Rammer's code.

7. Ingo: Custom Server Sink

8. Threads in AppDomain (Ingo please help ;-))



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 96 guest