[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Getting Events, for Windows Service

Patrick Jox

9/22/2004 6:21:00 PM

Hello,
I am wondering if it makes sense to find a solution for the following task.
I know, that I can receive events from remote application and succeeded
already to follow some examples. But I need a very specific architecture and
would like to know, if this is generally possible:

I have an application that resides and runs on a server as a windows
service. To configure this service I have a Windows Forms application on a
client and now want to communicate with the remote application through a
TcpChannel. This works so far, but now I need to catch the events that are
fired by the remote application to display working progress and other
information of the remote process.

I have tested the event handling with a local instance of my business
object. It works fine.

On the server I have an app object which is inherited from
MarshalByRefObject which provides different classes / objects. One of this
classes the so called logger should raise an event whenever it writes some
information and there must be a possibiltiy for the client to listen to this
event and to display what's going on on the server. When my logger object is
not inherited from MarshalByRefObject, I can register my eventlistener, but
the events do never arrive to it.
When the logger class inherits MarshalByRefObject I get an error
(System.Security.SecurityException) when I try to register the listener.
Additional Information is "System.DelegateSerializationHolder and the
inherited classes can not be deserialized in this security level"

I have not found any example with this specific constellation. Can anybody
tell me if this can work, and possibly point me out some hints to get the
events catched.

Every hint would be mostly appreciated
Thanks a lot
Patrick


13 Answers

Ken Kolda

9/22/2004 7:15:00 PM

0

Have you set the TypeFilterLevel on the client and server to be Full as in
the following article?

http://www.thinktecture.com/Resources/RemotingFAQ/Change...

Ken


"Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> Hello,
> I am wondering if it makes sense to find a solution for the following
task.
> I know, that I can receive events from remote application and succeeded
> already to follow some examples. But I need a very specific architecture
and
> would like to know, if this is generally possible:
>
> I have an application that resides and runs on a server as a windows
> service. To configure this service I have a Windows Forms application on a
> client and now want to communicate with the remote application through a
> TcpChannel. This works so far, but now I need to catch the events that are
> fired by the remote application to display working progress and other
> information of the remote process.
>
> I have tested the event handling with a local instance of my business
> object. It works fine.
>
> On the server I have an app object which is inherited from
> MarshalByRefObject which provides different classes / objects. One of this
> classes the so called logger should raise an event whenever it writes some
> information and there must be a possibiltiy for the client to listen to
this
> event and to display what's going on on the server. When my logger object
is
> not inherited from MarshalByRefObject, I can register my eventlistener,
but
> the events do never arrive to it.
> When the logger class inherits MarshalByRefObject I get an error
> (System.Security.SecurityException) when I try to register the listener.
> Additional Information is "System.DelegateSerializationHolder and the
> inherited classes can not be deserialized in this security level"
>
> I have not found any example with this specific constellation. Can anybody
> tell me if this can work, and possibly point me out some hints to get the
> events catched.
>
> Every hint would be mostly appreciated
> Thanks a lot
> Patrick
>
>


Patrick Jox

9/23/2004 2:24:00 PM

0

Typefilter was solving the problem on my local machine. But now if somebody
else tries to run my client app he gets an timeout error. This has nothing
to do with eventhandling but as I fear with my architecture.

The server application has a public object called logger, which is
instantiated during construction of the app (I use the standard
constructor). When I try to access one of its members using app.Logger.Name
or I try to register my event I get a "System.Net.Sockets.SocketException"
saying, that connection to the server failed, because the host is not
responding.

When I give my app a member app.LoggerName and let him do this work, it
works. So it seems that the logger is properly instantiated and works.

Do you have any suggestions?

Thanks - Patrick


"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> Have you set the TypeFilterLevel on the client and server to be Full as in
> the following article?
>
> http://www.thinktecture.com/Resources/RemotingFAQ/Change...
>
> Ken
>
>
> "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > Hello,
> > I am wondering if it makes sense to find a solution for the following
> task.
> > I know, that I can receive events from remote application and succeeded
> > already to follow some examples. But I need a very specific architecture
> and
> > would like to know, if this is generally possible:
> >
> > I have an application that resides and runs on a server as a windows
> > service. To configure this service I have a Windows Forms application on
a
> > client and now want to communicate with the remote application through a
> > TcpChannel. This works so far, but now I need to catch the events that
are
> > fired by the remote application to display working progress and other
> > information of the remote process.
> >
> > I have tested the event handling with a local instance of my business
> > object. It works fine.
> >
> > On the server I have an app object which is inherited from
> > MarshalByRefObject which provides different classes / objects. One of
this
> > classes the so called logger should raise an event whenever it writes
some
> > information and there must be a possibiltiy for the client to listen to
> this
> > event and to display what's going on on the server. When my logger
object
> is
> > not inherited from MarshalByRefObject, I can register my eventlistener,
> but
> > the events do never arrive to it.
> > When the logger class inherits MarshalByRefObject I get an error
> > (System.Security.SecurityException) when I try to register the listener.
> > Additional Information is "System.DelegateSerializationHolder and the
> > inherited classes can not be deserialized in this security level"
> >
> > I have not found any example with this specific constellation. Can
anybody
> > tell me if this can work, and possibly point me out some hints to get
the
> > events catched.
> >
> > Every hint would be mostly appreciated
> > Thanks a lot
> > Patrick
> >
> >
>
>


Ken Kolda

9/23/2004 3:18:00 PM

0

My best guess is that your server is behind a firewall/router that is
performing NAT. In this kind of setup your SAOs will work fine (which
explains why app.LoggerName works) but your CAOs will not (attempts to
invoke methods on them will generally result in a timeout). There are a
couple of different solutions to this problem -- the right one for you will
depend on your needs. Allen Anderson wrote a very nice article that explains
the problem and the solutions:

http://www.glacialcomponents.com/ArticleDetail/...

Hope that helps -
Ken


"Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> Typefilter was solving the problem on my local machine. But now if
somebody
> else tries to run my client app he gets an timeout error. This has nothing
> to do with eventhandling but as I fear with my architecture.
>
> The server application has a public object called logger, which is
> instantiated during construction of the app (I use the standard
> constructor). When I try to access one of its members using
app.Logger.Name
> or I try to register my event I get a "System.Net.Sockets.SocketException"
> saying, that connection to the server failed, because the host is not
> responding.
>
> When I give my app a member app.LoggerName and let him do this work, it
> works. So it seems that the logger is properly instantiated and works.
>
> Do you have any suggestions?
>
> Thanks - Patrick
>
>
> "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > Have you set the TypeFilterLevel on the client and server to be Full as
in
> > the following article?
> >
> > http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> >
> > Ken
> >
> >
> > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > Hello,
> > > I am wondering if it makes sense to find a solution for the following
> > task.
> > > I know, that I can receive events from remote application and
succeeded
> > > already to follow some examples. But I need a very specific
architecture
> > and
> > > would like to know, if this is generally possible:
> > >
> > > I have an application that resides and runs on a server as a windows
> > > service. To configure this service I have a Windows Forms application
on
> a
> > > client and now want to communicate with the remote application through
a
> > > TcpChannel. This works so far, but now I need to catch the events that
> are
> > > fired by the remote application to display working progress and other
> > > information of the remote process.
> > >
> > > I have tested the event handling with a local instance of my business
> > > object. It works fine.
> > >
> > > On the server I have an app object which is inherited from
> > > MarshalByRefObject which provides different classes / objects. One of
> this
> > > classes the so called logger should raise an event whenever it writes
> some
> > > information and there must be a possibiltiy for the client to listen
to
> > this
> > > event and to display what's going on on the server. When my logger
> object
> > is
> > > not inherited from MarshalByRefObject, I can register my
eventlistener,
> > but
> > > the events do never arrive to it.
> > > When the logger class inherits MarshalByRefObject I get an error
> > > (System.Security.SecurityException) when I try to register the
listener.
> > > Additional Information is "System.DelegateSerializationHolder and the
> > > inherited classes can not be deserialized in this security level"
> > >
> > > I have not found any example with this specific constellation. Can
> anybody
> > > tell me if this can work, and possibly point me out some hints to get
> the
> > > events catched.
> > >
> > > Every hint would be mostly appreciated
> > > Thanks a lot
> > > Patrick
> > >
> > >
> >
> >
>
>


Patrick Jox

9/23/2004 3:38:00 PM

0

Hmm, both machines are located in my LAN. But your right. I have Zonealarm
on my Server. But as far as I know there is no IP-Translation. I even
thought that this might be a problem and stopped the firewall. No result. I
still have the same behavior?

The windows internal internet firewall is not active on my LAN connection.

Any other ideas?

Thanks - Patrick


"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
news:%233SEiCYoEHA.2636@TK2MSFTNGP09.phx.gbl...
> My best guess is that your server is behind a firewall/router that is
> performing NAT. In this kind of setup your SAOs will work fine (which
> explains why app.LoggerName works) but your CAOs will not (attempts to
> invoke methods on them will generally result in a timeout). There are a
> couple of different solutions to this problem -- the right one for you
will
> depend on your needs. Allen Anderson wrote a very nice article that
explains
> the problem and the solutions:
>
> http://www.glacialcomponents.com/ArticleDetail/...
>
> Hope that helps -
> Ken
>
>
> "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> > Typefilter was solving the problem on my local machine. But now if
> somebody
> > else tries to run my client app he gets an timeout error. This has
nothing
> > to do with eventhandling but as I fear with my architecture.
> >
> > The server application has a public object called logger, which is
> > instantiated during construction of the app (I use the standard
> > constructor). When I try to access one of its members using
> app.Logger.Name
> > or I try to register my event I get a
"System.Net.Sockets.SocketException"
> > saying, that connection to the server failed, because the host is not
> > responding.
> >
> > When I give my app a member app.LoggerName and let him do this work, it
> > works. So it seems that the logger is properly instantiated and works.
> >
> > Do you have any suggestions?
> >
> > Thanks - Patrick
> >
> >
> > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> > news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > > Have you set the TypeFilterLevel on the client and server to be Full
as
> in
> > > the following article?
> > >
> > > http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> > >
> > > Ken
> > >
> > >
> > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > > Hello,
> > > > I am wondering if it makes sense to find a solution for the
following
> > > task.
> > > > I know, that I can receive events from remote application and
> succeeded
> > > > already to follow some examples. But I need a very specific
> architecture
> > > and
> > > > would like to know, if this is generally possible:
> > > >
> > > > I have an application that resides and runs on a server as a windows
> > > > service. To configure this service I have a Windows Forms
application
> on
> > a
> > > > client and now want to communicate with the remote application
through
> a
> > > > TcpChannel. This works so far, but now I need to catch the events
that
> > are
> > > > fired by the remote application to display working progress and
other
> > > > information of the remote process.
> > > >
> > > > I have tested the event handling with a local instance of my
business
> > > > object. It works fine.
> > > >
> > > > On the server I have an app object which is inherited from
> > > > MarshalByRefObject which provides different classes / objects. One
of
> > this
> > > > classes the so called logger should raise an event whenever it
writes
> > some
> > > > information and there must be a possibiltiy for the client to listen
> to
> > > this
> > > > event and to display what's going on on the server. When my logger
> > object
> > > is
> > > > not inherited from MarshalByRefObject, I can register my
> eventlistener,
> > > but
> > > > the events do never arrive to it.
> > > > When the logger class inherits MarshalByRefObject I get an error
> > > > (System.Security.SecurityException) when I try to register the
> listener.
> > > > Additional Information is "System.DelegateSerializationHolder and
the
> > > > inherited classes can not be deserialized in this security level"
> > > >
> > > > I have not found any example with this specific constellation. Can
> > anybody
> > > > tell me if this can work, and possibly point me out some hints to
get
> > the
> > > > events catched.
> > > >
> > > > Every hint would be mostly appreciated
> > > > Thanks a lot
> > > > Patrick
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Ken Kolda

9/23/2004 5:31:00 PM

0

ZoneAlarm wouldnt cause the problem you're seeing -- you're able to connect
to the server but can't use your CAOs. By any chance, have you specified a
"machineName" or "useIpAddress" parameter for your server's channel?

What I would do next is this: after you get a refrence to the Logger object
in the client, serialize the proxy's underlying ObjRef to disk and take a
look at it. The code would look something like this:

Logger log = app.Logger;
ObjRef objref = RemotingServices.GetObjRefForProxy(log);
SoapFormatter fmt = new SoapFormatter();
using (FileStream fs = File.Create("C:\\objref.txt"))
ftm.Serialize(fmt, objref);

In the objref.txt file you should be able to find the URI to be used for the
object, e.g. "tcp://myserver:8080/". What you should verify is that the
value "myserver" is a name or IP that can be resolved by the client to the
correct IP address for the server. If your client can't resolve this name,
then you'll need to use the "machineName" parameter in the server's config
file to override "myserver" with something the client can use, such as the
server's IP.

Good luck -
Ken


"Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
message news:u1XjbPYoEHA.3896@TK2MSFTNGP15.phx.gbl...
> Hmm, both machines are located in my LAN. But your right. I have Zonealarm
> on my Server. But as far as I know there is no IP-Translation. I even
> thought that this might be a problem and stopped the firewall. No result.
I
> still have the same behavior?
>
> The windows internal internet firewall is not active on my LAN connection.
>
> Any other ideas?
>
> Thanks - Patrick
>
>
> "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> news:%233SEiCYoEHA.2636@TK2MSFTNGP09.phx.gbl...
> > My best guess is that your server is behind a firewall/router that is
> > performing NAT. In this kind of setup your SAOs will work fine (which
> > explains why app.LoggerName works) but your CAOs will not (attempts to
> > invoke methods on them will generally result in a timeout). There are a
> > couple of different solutions to this problem -- the right one for you
> will
> > depend on your needs. Allen Anderson wrote a very nice article that
> explains
> > the problem and the solutions:
> >
> > http://www.glacialcomponents.com/ArticleDetail/...
> >
> > Hope that helps -
> > Ken
> >
> >
> > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > Typefilter was solving the problem on my local machine. But now if
> > somebody
> > > else tries to run my client app he gets an timeout error. This has
> nothing
> > > to do with eventhandling but as I fear with my architecture.
> > >
> > > The server application has a public object called logger, which is
> > > instantiated during construction of the app (I use the standard
> > > constructor). When I try to access one of its members using
> > app.Logger.Name
> > > or I try to register my event I get a
> "System.Net.Sockets.SocketException"
> > > saying, that connection to the server failed, because the host is not
> > > responding.
> > >
> > > When I give my app a member app.LoggerName and let him do this work,
it
> > > works. So it seems that the logger is properly instantiated and works.
> > >
> > > Do you have any suggestions?
> > >
> > > Thanks - Patrick
> > >
> > >
> > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
Newsbeitrag
> > > news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > > > Have you set the TypeFilterLevel on the client and server to be Full
> as
> > in
> > > > the following article?
> > > >
> > > > http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> > > >
> > > > Ken
> > > >
> > > >
> > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote
in
> > > > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > > > Hello,
> > > > > I am wondering if it makes sense to find a solution for the
> following
> > > > task.
> > > > > I know, that I can receive events from remote application and
> > succeeded
> > > > > already to follow some examples. But I need a very specific
> > architecture
> > > > and
> > > > > would like to know, if this is generally possible:
> > > > >
> > > > > I have an application that resides and runs on a server as a
windows
> > > > > service. To configure this service I have a Windows Forms
> application
> > on
> > > a
> > > > > client and now want to communicate with the remote application
> through
> > a
> > > > > TcpChannel. This works so far, but now I need to catch the events
> that
> > > are
> > > > > fired by the remote application to display working progress and
> other
> > > > > information of the remote process.
> > > > >
> > > > > I have tested the event handling with a local instance of my
> business
> > > > > object. It works fine.
> > > > >
> > > > > On the server I have an app object which is inherited from
> > > > > MarshalByRefObject which provides different classes / objects. One
> of
> > > this
> > > > > classes the so called logger should raise an event whenever it
> writes
> > > some
> > > > > information and there must be a possibiltiy for the client to
listen
> > to
> > > > this
> > > > > event and to display what's going on on the server. When my logger
> > > object
> > > > is
> > > > > not inherited from MarshalByRefObject, I can register my
> > eventlistener,
> > > > but
> > > > > the events do never arrive to it.
> > > > > When the logger class inherits MarshalByRefObject I get an error
> > > > > (System.Security.SecurityException) when I try to register the
> > listener.
> > > > > Additional Information is "System.DelegateSerializationHolder and
> the
> > > > > inherited classes can not be deserialized in this security level"
> > > > >
> > > > > I have not found any example with this specific constellation. Can
> > > anybody
> > > > > tell me if this can work, and possibly point me out some hints to
> get
> > > the
> > > > > events catched.
> > > > >
> > > > > Every hint would be mostly appreciated
> > > > > Thanks a lot
> > > > > Patrick
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Patrick Jox

9/24/2004 3:27:00 PM

0

Hi Ken,
thank you for your patience. Today I worked around and build up a small
application to reproduce my problem.

I tried to work with your hints. My first problem is, where do I specify the
"machinName" or "useIpAddress" parameter. I did not find any information in
MSDN Library.

I have attached my demo application and the file "objref.txt" aswell as my
"error.txt".

If you are willing to reproduce the problem. Input a letter in the
"SearchBy" textbox and click "LoadAddressList". Then select an entry and
click "Load AddressItem". The error occurs just after the messagebox when
you try to access a addressitem object.

Maybe you can see my problem with a quick look?

Thanks - Patrick

"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
news:OqhgkMZoEHA.4008@TK2MSFTNGP14.phx.gbl...
> ZoneAlarm wouldnt cause the problem you're seeing -- you're able to
connect
> to the server but can't use your CAOs. By any chance, have you specified a
> "machineName" or "useIpAddress" parameter for your server's channel?
>
> What I would do next is this: after you get a refrence to the Logger
object
> in the client, serialize the proxy's underlying ObjRef to disk and take a
> look at it. The code would look something like this:
>
> Logger log = app.Logger;
> ObjRef objref = RemotingServices.GetObjRefForProxy(log);
> SoapFormatter fmt = new SoapFormatter();
> using (FileStream fs = File.Create("C:\\objref.txt"))
> ftm.Serialize(fmt, objref);
>
> In the objref.txt file you should be able to find the URI to be used for
the
> object, e.g. "tcp://myserver:8080/". What you should verify is that the
> value "myserver" is a name or IP that can be resolved by the client to the
> correct IP address for the server. If your client can't resolve this name,
> then you'll need to use the "machineName" parameter in the server's config
> file to override "myserver" with something the client can use, such as the
> server's IP.
>
> Good luck -
> Ken
>
>
> "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> message news:u1XjbPYoEHA.3896@TK2MSFTNGP15.phx.gbl...
> > Hmm, both machines are located in my LAN. But your right. I have
Zonealarm
> > on my Server. But as far as I know there is no IP-Translation. I even
> > thought that this might be a problem and stopped the firewall. No
result.
> I
> > still have the same behavior?
> >
> > The windows internal internet firewall is not active on my LAN
connection.
> >
> > Any other ideas?
> >
> > Thanks - Patrick
> >
> >
> > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> > news:%233SEiCYoEHA.2636@TK2MSFTNGP09.phx.gbl...
> > > My best guess is that your server is behind a firewall/router that is
> > > performing NAT. In this kind of setup your SAOs will work fine (which
> > > explains why app.LoggerName works) but your CAOs will not (attempts to
> > > invoke methods on them will generally result in a timeout). There are
a
> > > couple of different solutions to this problem -- the right one for you
> > will
> > > depend on your needs. Allen Anderson wrote a very nice article that
> > explains
> > > the problem and the solutions:
> > >
> > > http://www.glacialcomponents.com/ArticleDetail/...
> > >
> > > Hope that helps -
> > > Ken
> > >
> > >
> > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > > message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > > Typefilter was solving the problem on my local machine. But now if
> > > somebody
> > > > else tries to run my client app he gets an timeout error. This has
> > nothing
> > > > to do with eventhandling but as I fear with my architecture.
> > > >
> > > > The server application has a public object called logger, which is
> > > > instantiated during construction of the app (I use the standard
> > > > constructor). When I try to access one of its members using
> > > app.Logger.Name
> > > > or I try to register my event I get a
> > "System.Net.Sockets.SocketException"
> > > > saying, that connection to the server failed, because the host is
not
> > > > responding.
> > > >
> > > > When I give my app a member app.LoggerName and let him do this work,
> it
> > > > works. So it seems that the logger is properly instantiated and
works.
> > > >
> > > > Do you have any suggestions?
> > > >
> > > > Thanks - Patrick
> > > >
> > > >
> > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> Newsbeitrag
> > > > news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > > > > Have you set the TypeFilterLevel on the client and server to be
Full
> > as
> > > in
> > > > > the following article?
> > > > >
> > > > > http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> > > > >
> > > > > Ken
> > > > >
> > > > >
> > > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
wrote
> in
> > > > > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > > > > Hello,
> > > > > > I am wondering if it makes sense to find a solution for the
> > following
> > > > > task.
> > > > > > I know, that I can receive events from remote application and
> > > succeeded
> > > > > > already to follow some examples. But I need a very specific
> > > architecture
> > > > > and
> > > > > > would like to know, if this is generally possible:
> > > > > >
> > > > > > I have an application that resides and runs on a server as a
> windows
> > > > > > service. To configure this service I have a Windows Forms
> > application
> > > on
> > > > a
> > > > > > client and now want to communicate with the remote application
> > through
> > > a
> > > > > > TcpChannel. This works so far, but now I need to catch the
events
> > that
> > > > are
> > > > > > fired by the remote application to display working progress and
> > other
> > > > > > information of the remote process.
> > > > > >
> > > > > > I have tested the event handling with a local instance of my
> > business
> > > > > > object. It works fine.
> > > > > >
> > > > > > On the server I have an app object which is inherited from
> > > > > > MarshalByRefObject which provides different classes / objects.
One
> > of
> > > > this
> > > > > > classes the so called logger should raise an event whenever it
> > writes
> > > > some
> > > > > > information and there must be a possibiltiy for the client to
> listen
> > > to
> > > > > this
> > > > > > event and to display what's going on on the server. When my
logger
> > > > object
> > > > > is
> > > > > > not inherited from MarshalByRefObject, I can register my
> > > eventlistener,
> > > > > but
> > > > > > the events do never arrive to it.
> > > > > > When the logger class inherits MarshalByRefObject I get an error
> > > > > > (System.Security.SecurityException) when I try to register the
> > > listener.
> > > > > > Additional Information is "System.DelegateSerializationHolder
and
> > the
> > > > > > inherited classes can not be deserialized in this security
level"
> > > > > >
> > > > > > I have not found any example with this specific constellation.
Can
> > > > anybody
> > > > > > tell me if this can work, and possibly point me out some hints
to
> > get
> > > > the
> > > > > > events catched.
> > > > > >
> > > > > > Every hint would be mostly appreciated
> > > > > > Thanks a lot
> > > > > > Patrick
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Ken Kolda

9/24/2004 4:02:00 PM

0

First, the code worked fine on my system (once I removed the database access
code). So, I uncommented the line that registers the event handler, i.e.

am.OnActionHandler += new
BusinessLogik.Addressmanager.ActionEventHandler(this.am_OnActionHander);

Once I did this I ran into a couple of problems. They are:

1) Your event handler, am_OnActionHander, is private. When you pass an event
handler over a remoting interface you must use a public method -- this is a
security restriction.

2) The function am_OnActionHander attempts to modify form controls wven
though it is executed on a non-UI thread. As a result, the client app will
hang when this event handler is called. You need to use the Form.Invoke()
method to invoke a method on the UI thread that will update the form
elements.

Hope that helps -
Ken


"Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
message news:%23ykYUwkoEHA.3324@TK2MSFTNGP15.phx.gbl...
> Hi Ken,
> thank you for your patience. Today I worked around and build up a small
> application to reproduce my problem.
>
> I tried to work with your hints. My first problem is, where do I specify
the
> "machinName" or "useIpAddress" parameter. I did not find any information
in
> MSDN Library.
>
> I have attached my demo application and the file "objref.txt" aswell as my
> "error.txt".
>
> If you are willing to reproduce the problem. Input a letter in the
> "SearchBy" textbox and click "LoadAddressList". Then select an entry and
> click "Load AddressItem". The error occurs just after the messagebox when
> you try to access a addressitem object.
>
> Maybe you can see my problem with a quick look?
>
> Thanks - Patrick
>
> "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> news:OqhgkMZoEHA.4008@TK2MSFTNGP14.phx.gbl...
> > ZoneAlarm wouldnt cause the problem you're seeing -- you're able to
> connect
> > to the server but can't use your CAOs. By any chance, have you specified
a
> > "machineName" or "useIpAddress" parameter for your server's channel?
> >
> > What I would do next is this: after you get a refrence to the Logger
> object
> > in the client, serialize the proxy's underlying ObjRef to disk and take
a
> > look at it. The code would look something like this:
> >
> > Logger log = app.Logger;
> > ObjRef objref = RemotingServices.GetObjRefForProxy(log);
> > SoapFormatter fmt = new SoapFormatter();
> > using (FileStream fs = File.Create("C:\\objref.txt"))
> > ftm.Serialize(fmt, objref);
> >
> > In the objref.txt file you should be able to find the URI to be used for
> the
> > object, e.g. "tcp://myserver:8080/". What you should verify is that the
> > value "myserver" is a name or IP that can be resolved by the client to
the
> > correct IP address for the server. If your client can't resolve this
name,
> > then you'll need to use the "machineName" parameter in the server's
config
> > file to override "myserver" with something the client can use, such as
the
> > server's IP.
> >
> > Good luck -
> > Ken
> >
> >
> > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > message news:u1XjbPYoEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > Hmm, both machines are located in my LAN. But your right. I have
> Zonealarm
> > > on my Server. But as far as I know there is no IP-Translation. I even
> > > thought that this might be a problem and stopped the firewall. No
> result.
> > I
> > > still have the same behavior?
> > >
> > > The windows internal internet firewall is not active on my LAN
> connection.
> > >
> > > Any other ideas?
> > >
> > > Thanks - Patrick
> > >
> > >
> > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
Newsbeitrag
> > > news:%233SEiCYoEHA.2636@TK2MSFTNGP09.phx.gbl...
> > > > My best guess is that your server is behind a firewall/router that
is
> > > > performing NAT. In this kind of setup your SAOs will work fine
(which
> > > > explains why app.LoggerName works) but your CAOs will not (attempts
to
> > > > invoke methods on them will generally result in a timeout). There
are
> a
> > > > couple of different solutions to this problem -- the right one for
you
> > > will
> > > > depend on your needs. Allen Anderson wrote a very nice article that
> > > explains
> > > > the problem and the solutions:
> > > >
> > > > http://www.glacialcomponents.com/ArticleDetail/...
> > > >
> > > > Hope that helps -
> > > > Ken
> > > >
> > > >
> > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote
in
> > > > message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > > > Typefilter was solving the problem on my local machine. But now if
> > > > somebody
> > > > > else tries to run my client app he gets an timeout error. This has
> > > nothing
> > > > > to do with eventhandling but as I fear with my architecture.
> > > > >
> > > > > The server application has a public object called logger, which is
> > > > > instantiated during construction of the app (I use the standard
> > > > > constructor). When I try to access one of its members using
> > > > app.Logger.Name
> > > > > or I try to register my event I get a
> > > "System.Net.Sockets.SocketException"
> > > > > saying, that connection to the server failed, because the host is
> not
> > > > > responding.
> > > > >
> > > > > When I give my app a member app.LoggerName and let him do this
work,
> > it
> > > > > works. So it seems that the logger is properly instantiated and
> works.
> > > > >
> > > > > Do you have any suggestions?
> > > > >
> > > > > Thanks - Patrick
> > > > >
> > > > >
> > > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> > Newsbeitrag
> > > > > news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > > > > > Have you set the TypeFilterLevel on the client and server to be
> Full
> > > as
> > > > in
> > > > > > the following article?
> > > > > >
> > > > > >
http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> > > > > >
> > > > > > Ken
> > > > > >
> > > > > >
> > > > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
> wrote
> > in
> > > > > > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > > > > > Hello,
> > > > > > > I am wondering if it makes sense to find a solution for the
> > > following
> > > > > > task.
> > > > > > > I know, that I can receive events from remote application and
> > > > succeeded
> > > > > > > already to follow some examples. But I need a very specific
> > > > architecture
> > > > > > and
> > > > > > > would like to know, if this is generally possible:
> > > > > > >
> > > > > > > I have an application that resides and runs on a server as a
> > windows
> > > > > > > service. To configure this service I have a Windows Forms
> > > application
> > > > on
> > > > > a
> > > > > > > client and now want to communicate with the remote application
> > > through
> > > > a
> > > > > > > TcpChannel. This works so far, but now I need to catch the
> events
> > > that
> > > > > are
> > > > > > > fired by the remote application to display working progress
and
> > > other
> > > > > > > information of the remote process.
> > > > > > >
> > > > > > > I have tested the event handling with a local instance of my
> > > business
> > > > > > > object. It works fine.
> > > > > > >
> > > > > > > On the server I have an app object which is inherited from
> > > > > > > MarshalByRefObject which provides different classes / objects.
> One
> > > of
> > > > > this
> > > > > > > classes the so called logger should raise an event whenever it
> > > writes
> > > > > some
> > > > > > > information and there must be a possibiltiy for the client to
> > listen
> > > > to
> > > > > > this
> > > > > > > event and to display what's going on on the server. When my
> logger
> > > > > object
> > > > > > is
> > > > > > > not inherited from MarshalByRefObject, I can register my
> > > > eventlistener,
> > > > > > but
> > > > > > > the events do never arrive to it.
> > > > > > > When the logger class inherits MarshalByRefObject I get an
error
> > > > > > > (System.Security.SecurityException) when I try to register the
> > > > listener.
> > > > > > > Additional Information is "System.DelegateSerializationHolder
> and
> > > the
> > > > > > > inherited classes can not be deserialized in this security
> level"
> > > > > > >
> > > > > > > I have not found any example with this specific constellation.
> Can
> > > > > anybody
> > > > > > > tell me if this can work, and possibly point me out some hints
> to
> > > get
> > > > > the
> > > > > > > events catched.
> > > > > > >
> > > > > > > Every hint would be mostly appreciated
> > > > > > > Thanks a lot
> > > > > > > Patrick
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
>


Patrick Jox

9/24/2004 6:20:00 PM

0

OK, thanks a lot. The thing with the event works fine now. But I am still
having problems with the addressitem. It works fine when I access it from
the local machine, where my server is hosted. But when I access it from
another machine I get an error as posted before, when I access the
addressitems id. I get the addresslist properly.

Have you any idea for this?

Best regards and thank you very much so far
Patrick

"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
news:Of3YZ$koEHA.596@TK2MSFTNGP11.phx.gbl...
> First, the code worked fine on my system (once I removed the database
access
> code). So, I uncommented the line that registers the event handler, i.e.
>
> am.OnActionHandler += new
> BusinessLogik.Addressmanager.ActionEventHandler(this.am_OnActionHander);
>
> Once I did this I ran into a couple of problems. They are:
>
> 1) Your event handler, am_OnActionHander, is private. When you pass an
event
> handler over a remoting interface you must use a public method -- this is
a
> security restriction.
>
> 2) The function am_OnActionHander attempts to modify form controls wven
> though it is executed on a non-UI thread. As a result, the client app will
> hang when this event handler is called. You need to use the Form.Invoke()
> method to invoke a method on the UI thread that will update the form
> elements.
>
> Hope that helps -
> Ken
>
>
> "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> message news:%23ykYUwkoEHA.3324@TK2MSFTNGP15.phx.gbl...
> > Hi Ken,
> > thank you for your patience. Today I worked around and build up a small
> > application to reproduce my problem.
> >
> > I tried to work with your hints. My first problem is, where do I specify
> the
> > "machinName" or "useIpAddress" parameter. I did not find any information
> in
> > MSDN Library.
> >
> > I have attached my demo application and the file "objref.txt" aswell as
my
> > "error.txt".
> >
> > If you are willing to reproduce the problem. Input a letter in the
> > "SearchBy" textbox and click "LoadAddressList". Then select an entry and
> > click "Load AddressItem". The error occurs just after the messagebox
when
> > you try to access a addressitem object.
> >
> > Maybe you can see my problem with a quick look?
> >
> > Thanks - Patrick
> >
> > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> > news:OqhgkMZoEHA.4008@TK2MSFTNGP14.phx.gbl...
> > > ZoneAlarm wouldnt cause the problem you're seeing -- you're able to
> > connect
> > > to the server but can't use your CAOs. By any chance, have you
specified
> a
> > > "machineName" or "useIpAddress" parameter for your server's channel?
> > >
> > > What I would do next is this: after you get a refrence to the Logger
> > object
> > > in the client, serialize the proxy's underlying ObjRef to disk and
take
> a
> > > look at it. The code would look something like this:
> > >
> > > Logger log = app.Logger;
> > > ObjRef objref = RemotingServices.GetObjRefForProxy(log);
> > > SoapFormatter fmt = new SoapFormatter();
> > > using (FileStream fs = File.Create("C:\\objref.txt"))
> > > ftm.Serialize(fmt, objref);
> > >
> > > In the objref.txt file you should be able to find the URI to be used
for
> > the
> > > object, e.g. "tcp://myserver:8080/". What you should verify is that
the
> > > value "myserver" is a name or IP that can be resolved by the client to
> the
> > > correct IP address for the server. If your client can't resolve this
> name,
> > > then you'll need to use the "machineName" parameter in the server's
> config
> > > file to override "myserver" with something the client can use, such as
> the
> > > server's IP.
> > >
> > > Good luck -
> > > Ken
> > >
> > >
> > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > > message news:u1XjbPYoEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > > Hmm, both machines are located in my LAN. But your right. I have
> > Zonealarm
> > > > on my Server. But as far as I know there is no IP-Translation. I
even
> > > > thought that this might be a problem and stopped the firewall. No
> > result.
> > > I
> > > > still have the same behavior?
> > > >
> > > > The windows internal internet firewall is not active on my LAN
> > connection.
> > > >
> > > > Any other ideas?
> > > >
> > > > Thanks - Patrick
> > > >
> > > >
> > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> Newsbeitrag
> > > > news:%233SEiCYoEHA.2636@TK2MSFTNGP09.phx.gbl...
> > > > > My best guess is that your server is behind a firewall/router that
> is
> > > > > performing NAT. In this kind of setup your SAOs will work fine
> (which
> > > > > explains why app.LoggerName works) but your CAOs will not
(attempts
> to
> > > > > invoke methods on them will generally result in a timeout). There
> are
> > a
> > > > > couple of different solutions to this problem -- the right one for
> you
> > > > will
> > > > > depend on your needs. Allen Anderson wrote a very nice article
that
> > > > explains
> > > > > the problem and the solutions:
> > > > >
> > > > > http://www.glacialcomponents.com/ArticleDetail/...
> > > > >
> > > > > Hope that helps -
> > > > > Ken
> > > > >
> > > > >
> > > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
wrote
> in
> > > > > message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > > > > Typefilter was solving the problem on my local machine. But now
if
> > > > > somebody
> > > > > > else tries to run my client app he gets an timeout error. This
has
> > > > nothing
> > > > > > to do with eventhandling but as I fear with my architecture.
> > > > > >
> > > > > > The server application has a public object called logger, which
is
> > > > > > instantiated during construction of the app (I use the standard
> > > > > > constructor). When I try to access one of its members using
> > > > > app.Logger.Name
> > > > > > or I try to register my event I get a
> > > > "System.Net.Sockets.SocketException"
> > > > > > saying, that connection to the server failed, because the host
is
> > not
> > > > > > responding.
> > > > > >
> > > > > > When I give my app a member app.LoggerName and let him do this
> work,
> > > it
> > > > > > works. So it seems that the logger is properly instantiated and
> > works.
> > > > > >
> > > > > > Do you have any suggestions?
> > > > > >
> > > > > > Thanks - Patrick
> > > > > >
> > > > > >
> > > > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> > > Newsbeitrag
> > > > > > news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > > > > > > Have you set the TypeFilterLevel on the client and server to
be
> > Full
> > > > as
> > > > > in
> > > > > > > the following article?
> > > > > > >
> > > > > > >
> http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> > > > > > >
> > > > > > > Ken
> > > > > > >
> > > > > > >
> > > > > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
> > wrote
> > > in
> > > > > > > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > > > > > > Hello,
> > > > > > > > I am wondering if it makes sense to find a solution for the
> > > > following
> > > > > > > task.
> > > > > > > > I know, that I can receive events from remote application
and
> > > > > succeeded
> > > > > > > > already to follow some examples. But I need a very specific
> > > > > architecture
> > > > > > > and
> > > > > > > > would like to know, if this is generally possible:
> > > > > > > >
> > > > > > > > I have an application that resides and runs on a server as a
> > > windows
> > > > > > > > service. To configure this service I have a Windows Forms
> > > > application
> > > > > on
> > > > > > a
> > > > > > > > client and now want to communicate with the remote
application
> > > > through
> > > > > a
> > > > > > > > TcpChannel. This works so far, but now I need to catch the
> > events
> > > > that
> > > > > > are
> > > > > > > > fired by the remote application to display working progress
> and
> > > > other
> > > > > > > > information of the remote process.
> > > > > > > >
> > > > > > > > I have tested the event handling with a local instance of my
> > > > business
> > > > > > > > object. It works fine.
> > > > > > > >
> > > > > > > > On the server I have an app object which is inherited from
> > > > > > > > MarshalByRefObject which provides different classes /
objects.
> > One
> > > > of
> > > > > > this
> > > > > > > > classes the so called logger should raise an event whenever
it
> > > > writes
> > > > > > some
> > > > > > > > information and there must be a possibiltiy for the client
to
> > > listen
> > > > > to
> > > > > > > this
> > > > > > > > event and to display what's going on on the server. When my
> > logger
> > > > > > object
> > > > > > > is
> > > > > > > > not inherited from MarshalByRefObject, I can register my
> > > > > eventlistener,
> > > > > > > but
> > > > > > > > the events do never arrive to it.
> > > > > > > > When the logger class inherits MarshalByRefObject I get an
> error
> > > > > > > > (System.Security.SecurityException) when I try to register
the
> > > > > listener.
> > > > > > > > Additional Information is
"System.DelegateSerializationHolder
> > and
> > > > the
> > > > > > > > inherited classes can not be deserialized in this security
> > level"
> > > > > > > >
> > > > > > > > I have not found any example with this specific
constellation.
> > Can
> > > > > > anybody
> > > > > > > > tell me if this can work, and possibly point me out some
hints
> > to
> > > > get
> > > > > > the
> > > > > > > > events catched.
> > > > > > > >
> > > > > > > > Every hint would be mostly appreciated
> > > > > > > > Thanks a lot
> > > > > > > > Patrick
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
>
>


Ken Kolda

9/24/2004 11:29:00 PM

0

The ObjRef that you posted shows an IP address of 169.254.25.129. Is this IP
address accessible from the client machine? And is port 10445 accessible? If
you haven't tried this already, start your server up and then, from the
client machine, run:

telnet 169.254.25.129 10445

If you get the "Could not open a connection...", then you've got a network
issue. If you can get thru and connect, then I'll be somewhat confused over
why this won't work.

All that said, any reason your AddressItem class is MarshalByRef? This is
exactly the type of class that I would simply make serializable and allow it
to be passed in its entirety to the client. Having to go across the network
for each method call will be far less efficient than fetching all the data
at once.

Ken



"Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
message news:O7GogOmoEHA.2864@TK2MSFTNGP12.phx.gbl...
> OK, thanks a lot. The thing with the event works fine now. But I am still
> having problems with the addressitem. It works fine when I access it from
> the local machine, where my server is hosted. But when I access it from
> another machine I get an error as posted before, when I access the
> addressitems id. I get the addresslist properly.
>
> Have you any idea for this?
>
> Best regards and thank you very much so far
> Patrick
>
> "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> news:Of3YZ$koEHA.596@TK2MSFTNGP11.phx.gbl...
> > First, the code worked fine on my system (once I removed the database
> access
> > code). So, I uncommented the line that registers the event handler, i.e.
> >
> > am.OnActionHandler += new
> > BusinessLogik.Addressmanager.ActionEventHandler(this.am_OnActionHander);
> >
> > Once I did this I ran into a couple of problems. They are:
> >
> > 1) Your event handler, am_OnActionHander, is private. When you pass an
> event
> > handler over a remoting interface you must use a public method -- this
is
> a
> > security restriction.
> >
> > 2) The function am_OnActionHander attempts to modify form controls wven
> > though it is executed on a non-UI thread. As a result, the client app
will
> > hang when this event handler is called. You need to use the
Form.Invoke()
> > method to invoke a method on the UI thread that will update the form
> > elements.
> >
> > Hope that helps -
> > Ken
> >
> >
> > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > message news:%23ykYUwkoEHA.3324@TK2MSFTNGP15.phx.gbl...
> > > Hi Ken,
> > > thank you for your patience. Today I worked around and build up a
small
> > > application to reproduce my problem.
> > >
> > > I tried to work with your hints. My first problem is, where do I
specify
> > the
> > > "machinName" or "useIpAddress" parameter. I did not find any
information
> > in
> > > MSDN Library.
> > >
> > > I have attached my demo application and the file "objref.txt" aswell
as
> my
> > > "error.txt".
> > >
> > > If you are willing to reproduce the problem. Input a letter in the
> > > "SearchBy" textbox and click "LoadAddressList". Then select an entry
and
> > > click "Load AddressItem". The error occurs just after the messagebox
> when
> > > you try to access a addressitem object.
> > >
> > > Maybe you can see my problem with a quick look?
> > >
> > > Thanks - Patrick
> > >
> > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
Newsbeitrag
> > > news:OqhgkMZoEHA.4008@TK2MSFTNGP14.phx.gbl...
> > > > ZoneAlarm wouldnt cause the problem you're seeing -- you're able to
> > > connect
> > > > to the server but can't use your CAOs. By any chance, have you
> specified
> > a
> > > > "machineName" or "useIpAddress" parameter for your server's channel?
> > > >
> > > > What I would do next is this: after you get a refrence to the Logger
> > > object
> > > > in the client, serialize the proxy's underlying ObjRef to disk and
> take
> > a
> > > > look at it. The code would look something like this:
> > > >
> > > > Logger log = app.Logger;
> > > > ObjRef objref = RemotingServices.GetObjRefForProxy(log);
> > > > SoapFormatter fmt = new SoapFormatter();
> > > > using (FileStream fs = File.Create("C:\\objref.txt"))
> > > > ftm.Serialize(fmt, objref);
> > > >
> > > > In the objref.txt file you should be able to find the URI to be used
> for
> > > the
> > > > object, e.g. "tcp://myserver:8080/". What you should verify is that
> the
> > > > value "myserver" is a name or IP that can be resolved by the client
to
> > the
> > > > correct IP address for the server. If your client can't resolve this
> > name,
> > > > then you'll need to use the "machineName" parameter in the server's
> > config
> > > > file to override "myserver" with something the client can use, such
as
> > the
> > > > server's IP.
> > > >
> > > > Good luck -
> > > > Ken
> > > >
> > > >
> > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote
in
> > > > message news:u1XjbPYoEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > > > Hmm, both machines are located in my LAN. But your right. I have
> > > Zonealarm
> > > > > on my Server. But as far as I know there is no IP-Translation. I
> even
> > > > > thought that this might be a problem and stopped the firewall. No
> > > result.
> > > > I
> > > > > still have the same behavior?
> > > > >
> > > > > The windows internal internet firewall is not active on my LAN
> > > connection.
> > > > >
> > > > > Any other ideas?
> > > > >
> > > > > Thanks - Patrick
> > > > >
> > > > >
> > > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> > Newsbeitrag
> > > > > news:%233SEiCYoEHA.2636@TK2MSFTNGP09.phx.gbl...
> > > > > > My best guess is that your server is behind a firewall/router
that
> > is
> > > > > > performing NAT. In this kind of setup your SAOs will work fine
> > (which
> > > > > > explains why app.LoggerName works) but your CAOs will not
> (attempts
> > to
> > > > > > invoke methods on them will generally result in a timeout).
There
> > are
> > > a
> > > > > > couple of different solutions to this problem -- the right one
for
> > you
> > > > > will
> > > > > > depend on your needs. Allen Anderson wrote a very nice article
> that
> > > > > explains
> > > > > > the problem and the solutions:
> > > > > >
> > > > > > http://www.glacialcomponents.com/ArticleDetail/...
> > > > > >
> > > > > > Hope that helps -
> > > > > > Ken
> > > > > >
> > > > > >
> > > > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
> wrote
> > in
> > > > > > message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > > > > > Typefilter was solving the problem on my local machine. But
now
> if
> > > > > > somebody
> > > > > > > else tries to run my client app he gets an timeout error. This
> has
> > > > > nothing
> > > > > > > to do with eventhandling but as I fear with my architecture.
> > > > > > >
> > > > > > > The server application has a public object called logger,
which
> is
> > > > > > > instantiated during construction of the app (I use the
standard
> > > > > > > constructor). When I try to access one of its members using
> > > > > > app.Logger.Name
> > > > > > > or I try to register my event I get a
> > > > > "System.Net.Sockets.SocketException"
> > > > > > > saying, that connection to the server failed, because the host
> is
> > > not
> > > > > > > responding.
> > > > > > >
> > > > > > > When I give my app a member app.LoggerName and let him do this
> > work,
> > > > it
> > > > > > > works. So it seems that the logger is properly instantiated
and
> > > works.
> > > > > > >
> > > > > > > Do you have any suggestions?
> > > > > > >
> > > > > > > Thanks - Patrick
> > > > > > >
> > > > > > >
> > > > > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> > > > Newsbeitrag
> > > > > > > news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > > > > > > > Have you set the TypeFilterLevel on the client and server to
> be
> > > Full
> > > > > as
> > > > > > in
> > > > > > > > the following article?
> > > > > > > >
> > > > > > > >
> > http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> > > > > > > >
> > > > > > > > Ken
> > > > > > > >
> > > > > > > >
> > > > > > > > "Patrick Jox"
<Patrick@softwerk-n-o-s-p-a-m-technologies.com>
> > > wrote
> > > > in
> > > > > > > > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > Hello,
> > > > > > > > > I am wondering if it makes sense to find a solution for
the
> > > > > following
> > > > > > > > task.
> > > > > > > > > I know, that I can receive events from remote application
> and
> > > > > > succeeded
> > > > > > > > > already to follow some examples. But I need a very
specific
> > > > > > architecture
> > > > > > > > and
> > > > > > > > > would like to know, if this is generally possible:
> > > > > > > > >
> > > > > > > > > I have an application that resides and runs on a server as
a
> > > > windows
> > > > > > > > > service. To configure this service I have a Windows Forms
> > > > > application
> > > > > > on
> > > > > > > a
> > > > > > > > > client and now want to communicate with the remote
> application
> > > > > through
> > > > > > a
> > > > > > > > > TcpChannel. This works so far, but now I need to catch the
> > > events
> > > > > that
> > > > > > > are
> > > > > > > > > fired by the remote application to display working
progress
> > and
> > > > > other
> > > > > > > > > information of the remote process.
> > > > > > > > >
> > > > > > > > > I have tested the event handling with a local instance of
my
> > > > > business
> > > > > > > > > object. It works fine.
> > > > > > > > >
> > > > > > > > > On the server I have an app object which is inherited from
> > > > > > > > > MarshalByRefObject which provides different classes /
> objects.
> > > One
> > > > > of
> > > > > > > this
> > > > > > > > > classes the so called logger should raise an event
whenever
> it
> > > > > writes
> > > > > > > some
> > > > > > > > > information and there must be a possibiltiy for the client
> to
> > > > listen
> > > > > > to
> > > > > > > > this
> > > > > > > > > event and to display what's going on on the server. When
my
> > > logger
> > > > > > > object
> > > > > > > > is
> > > > > > > > > not inherited from MarshalByRefObject, I can register my
> > > > > > eventlistener,
> > > > > > > > but
> > > > > > > > > the events do never arrive to it.
> > > > > > > > > When the logger class inherits MarshalByRefObject I get an
> > error
> > > > > > > > > (System.Security.SecurityException) when I try to register
> the
> > > > > > listener.
> > > > > > > > > Additional Information is
> "System.DelegateSerializationHolder
> > > and
> > > > > the
> > > > > > > > > inherited classes can not be deserialized in this security
> > > level"
> > > > > > > > >
> > > > > > > > > I have not found any example with this specific
> constellation.
> > > Can
> > > > > > > anybody
> > > > > > > > > tell me if this can work, and possibly point me out some
> hints
> > > to
> > > > > get
> > > > > > > the
> > > > > > > > > events catched.
> > > > > > > > >
> > > > > > > > > Every hint would be mostly appreciated
> > > > > > > > > Thanks a lot
> > > > > > > > > Patrick
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>
>


Patrick Jox

9/26/2004 7:36:00 AM

0

Hi Ken,
ok this was the issue. I had an active Microsoft Loopback Adapter which
apparently generated this IP Address (169.254.25.129). After disabling this
Networkl Adapter everything worked fine.

Yes you are right. I had the addressitem marked as serializable. But after
having that trouble I tried nearly everything, I was a little panik :-)))
Now it works and I will delete the inheritance form MarshalByRefObject.

Ken you helped me very much, understanding what's going on.Thank you very
much for your help and for your patience. I hope I get a chance to give you
something back.

cu - Patrick


"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
news:e07BX5ooEHA.3460@TK2MSFTNGP15.phx.gbl...
> The ObjRef that you posted shows an IP address of 169.254.25.129. Is this
IP
> address accessible from the client machine? And is port 10445 accessible?
If
> you haven't tried this already, start your server up and then, from the
> client machine, run:
>
> telnet 169.254.25.129 10445
>
> If you get the "Could not open a connection...", then you've got a network
> issue. If you can get thru and connect, then I'll be somewhat confused
over
> why this won't work.
>
> All that said, any reason your AddressItem class is MarshalByRef? This is
> exactly the type of class that I would simply make serializable and allow
it
> to be passed in its entirety to the client. Having to go across the
network
> for each method call will be far less efficient than fetching all the data
> at once.
>
> Ken
>
>
>
> "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> message news:O7GogOmoEHA.2864@TK2MSFTNGP12.phx.gbl...
> > OK, thanks a lot. The thing with the event works fine now. But I am
still
> > having problems with the addressitem. It works fine when I access it
from
> > the local machine, where my server is hosted. But when I access it from
> > another machine I get an error as posted before, when I access the
> > addressitems id. I get the addresslist properly.
> >
> > Have you any idea for this?
> >
> > Best regards and thank you very much so far
> > Patrick
> >
> > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im Newsbeitrag
> > news:Of3YZ$koEHA.596@TK2MSFTNGP11.phx.gbl...
> > > First, the code worked fine on my system (once I removed the database
> > access
> > > code). So, I uncommented the line that registers the event handler,
i.e.
> > >
> > > am.OnActionHandler += new
> > >
BusinessLogik.Addressmanager.ActionEventHandler(this.am_OnActionHander);
> > >
> > > Once I did this I ran into a couple of problems. They are:
> > >
> > > 1) Your event handler, am_OnActionHander, is private. When you pass an
> > event
> > > handler over a remoting interface you must use a public method -- this
> is
> > a
> > > security restriction.
> > >
> > > 2) The function am_OnActionHander attempts to modify form controls
wven
> > > though it is executed on a non-UI thread. As a result, the client app
> will
> > > hang when this event handler is called. You need to use the
> Form.Invoke()
> > > method to invoke a method on the UI thread that will update the form
> > > elements.
> > >
> > > Hope that helps -
> > > Ken
> > >
> > >
> > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com> wrote in
> > > message news:%23ykYUwkoEHA.3324@TK2MSFTNGP15.phx.gbl...
> > > > Hi Ken,
> > > > thank you for your patience. Today I worked around and build up a
> small
> > > > application to reproduce my problem.
> > > >
> > > > I tried to work with your hints. My first problem is, where do I
> specify
> > > the
> > > > "machinName" or "useIpAddress" parameter. I did not find any
> information
> > > in
> > > > MSDN Library.
> > > >
> > > > I have attached my demo application and the file "objref.txt" aswell
> as
> > my
> > > > "error.txt".
> > > >
> > > > If you are willing to reproduce the problem. Input a letter in the
> > > > "SearchBy" textbox and click "LoadAddressList". Then select an entry
> and
> > > > click "Load AddressItem". The error occurs just after the messagebox
> > when
> > > > you try to access a addressitem object.
> > > >
> > > > Maybe you can see my problem with a quick look?
> > > >
> > > > Thanks - Patrick
> > > >
> > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> Newsbeitrag
> > > > news:OqhgkMZoEHA.4008@TK2MSFTNGP14.phx.gbl...
> > > > > ZoneAlarm wouldnt cause the problem you're seeing -- you're able
to
> > > > connect
> > > > > to the server but can't use your CAOs. By any chance, have you
> > specified
> > > a
> > > > > "machineName" or "useIpAddress" parameter for your server's
channel?
> > > > >
> > > > > What I would do next is this: after you get a refrence to the
Logger
> > > > object
> > > > > in the client, serialize the proxy's underlying ObjRef to disk and
> > take
> > > a
> > > > > look at it. The code would look something like this:
> > > > >
> > > > > Logger log = app.Logger;
> > > > > ObjRef objref = RemotingServices.GetObjRefForProxy(log);
> > > > > SoapFormatter fmt = new SoapFormatter();
> > > > > using (FileStream fs = File.Create("C:\\objref.txt"))
> > > > > ftm.Serialize(fmt, objref);
> > > > >
> > > > > In the objref.txt file you should be able to find the URI to be
used
> > for
> > > > the
> > > > > object, e.g. "tcp://myserver:8080/". What you should verify is
that
> > the
> > > > > value "myserver" is a name or IP that can be resolved by the
client
> to
> > > the
> > > > > correct IP address for the server. If your client can't resolve
this
> > > name,
> > > > > then you'll need to use the "machineName" parameter in the
server's
> > > config
> > > > > file to override "myserver" with something the client can use,
such
> as
> > > the
> > > > > server's IP.
> > > > >
> > > > > Good luck -
> > > > > Ken
> > > > >
> > > > >
> > > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
wrote
> in
> > > > > message news:u1XjbPYoEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > > > > Hmm, both machines are located in my LAN. But your right. I have
> > > > Zonealarm
> > > > > > on my Server. But as far as I know there is no IP-Translation. I
> > even
> > > > > > thought that this might be a problem and stopped the firewall.
No
> > > > result.
> > > > > I
> > > > > > still have the same behavior?
> > > > > >
> > > > > > The windows internal internet firewall is not active on my LAN
> > > > connection.
> > > > > >
> > > > > > Any other ideas?
> > > > > >
> > > > > > Thanks - Patrick
> > > > > >
> > > > > >
> > > > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> > > Newsbeitrag
> > > > > > news:%233SEiCYoEHA.2636@TK2MSFTNGP09.phx.gbl...
> > > > > > > My best guess is that your server is behind a firewall/router
> that
> > > is
> > > > > > > performing NAT. In this kind of setup your SAOs will work fine
> > > (which
> > > > > > > explains why app.LoggerName works) but your CAOs will not
> > (attempts
> > > to
> > > > > > > invoke methods on them will generally result in a timeout).
> There
> > > are
> > > > a
> > > > > > > couple of different solutions to this problem -- the right one
> for
> > > you
> > > > > > will
> > > > > > > depend on your needs. Allen Anderson wrote a very nice article
> > that
> > > > > > explains
> > > > > > > the problem and the solutions:
> > > > > > >
> > > > > > > http://www.glacialcomponents.com/ArticleDetail/...
> > > > > > >
> > > > > > > Hope that helps -
> > > > > > > Ken
> > > > > > >
> > > > > > >
> > > > > > > "Patrick Jox" <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
> > wrote
> > > in
> > > > > > > message news:OuFAEmXoEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > > > > > > Typefilter was solving the problem on my local machine. But
> now
> > if
> > > > > > > somebody
> > > > > > > > else tries to run my client app he gets an timeout error.
This
> > has
> > > > > > nothing
> > > > > > > > to do with eventhandling but as I fear with my architecture.
> > > > > > > >
> > > > > > > > The server application has a public object called logger,
> which
> > is
> > > > > > > > instantiated during construction of the app (I use the
> standard
> > > > > > > > constructor). When I try to access one of its members using
> > > > > > > app.Logger.Name
> > > > > > > > or I try to register my event I get a
> > > > > > "System.Net.Sockets.SocketException"
> > > > > > > > saying, that connection to the server failed, because the
host
> > is
> > > > not
> > > > > > > > responding.
> > > > > > > >
> > > > > > > > When I give my app a member app.LoggerName and let him do
this
> > > work,
> > > > > it
> > > > > > > > works. So it seems that the logger is properly instantiated
> and
> > > > works.
> > > > > > > >
> > > > > > > > Do you have any suggestions?
> > > > > > > >
> > > > > > > > Thanks - Patrick
> > > > > > > >
> > > > > > > >
> > > > > > > > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> schrieb im
> > > > > Newsbeitrag
> > > > > > > > news:%233pjZiNoEHA.1460@TK2MSFTNGP12.phx.gbl...
> > > > > > > > > Have you set the TypeFilterLevel on the client and server
to
> > be
> > > > Full
> > > > > > as
> > > > > > > in
> > > > > > > > > the following article?
> > > > > > > > >
> > > > > > > > >
> > > http://www.thinktecture.com/Resources/RemotingFAQ/Change...
> > > > > > > > >
> > > > > > > > > Ken
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "Patrick Jox"
> <Patrick@softwerk-n-o-s-p-a-m-technologies.com>
> > > > wrote
> > > > > in
> > > > > > > > > message news:OTCgAGNoEHA.3792@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > Hello,
> > > > > > > > > > I am wondering if it makes sense to find a solution for
> the
> > > > > > following
> > > > > > > > > task.
> > > > > > > > > > I know, that I can receive events from remote
application
> > and
> > > > > > > succeeded
> > > > > > > > > > already to follow some examples. But I need a very
> specific
> > > > > > > architecture
> > > > > > > > > and
> > > > > > > > > > would like to know, if this is generally possible:
> > > > > > > > > >
> > > > > > > > > > I have an application that resides and runs on a server
as
> a
> > > > > windows
> > > > > > > > > > service. To configure this service I have a Windows
Forms
> > > > > > application
> > > > > > > on
> > > > > > > > a
> > > > > > > > > > client and now want to communicate with the remote
> > application
> > > > > > through
> > > > > > > a
> > > > > > > > > > TcpChannel. This works so far, but now I need to catch
the
> > > > events
> > > > > > that
> > > > > > > > are
> > > > > > > > > > fired by the remote application to display working
> progress
> > > and
> > > > > > other
> > > > > > > > > > information of the remote process.
> > > > > > > > > >
> > > > > > > > > > I have tested the event handling with a local instance
of
> my
> > > > > > business
> > > > > > > > > > object. It works fine.
> > > > > > > > > >
> > > > > > > > > > On the server I have an app object which is inherited
from
> > > > > > > > > > MarshalByRefObject which provides different classes /
> > objects.
> > > > One
> > > > > > of
> > > > > > > > this
> > > > > > > > > > classes the so called logger should raise an event
> whenever
> > it
> > > > > > writes
> > > > > > > > some
> > > > > > > > > > information and there must be a possibiltiy for the
client
> > to
> > > > > listen
> > > > > > > to
> > > > > > > > > this
> > > > > > > > > > event and to display what's going on on the server. When
> my
> > > > logger
> > > > > > > > object
> > > > > > > > > is
> > > > > > > > > > not inherited from MarshalByRefObject, I can register my
> > > > > > > eventlistener,
> > > > > > > > > but
> > > > > > > > > > the events do never arrive to it.
> > > > > > > > > > When the logger class inherits MarshalByRefObject I get
an
> > > error
> > > > > > > > > > (System.Security.SecurityException) when I try to
register
> > the
> > > > > > > listener.
> > > > > > > > > > Additional Information is
> > "System.DelegateSerializationHolder
> > > > and
> > > > > > the
> > > > > > > > > > inherited classes can not be deserialized in this
security
> > > > level"
> > > > > > > > > >
> > > > > > > > > > I have not found any example with this specific
> > constellation.
> > > > Can
> > > > > > > > anybody
> > > > > > > > > > tell me if this can work, and possibly point me out some
> > hints
> > > > to
> > > > > > get
> > > > > > > > the
> > > > > > > > > > events catched.
> > > > > > > > > >
> > > > > > > > > > Every hint would be mostly appreciated
> > > > > > > > > > Thanks a lot
> > > > > > > > > > Patrick
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>