[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.remoting

Mike Woodring's .NET Sample Question - Remoting event

skyer.tw

9/22/2004 5:21:00 PM

Dear all:

I got a problem running Mike's remoting sample.
http://www.bearcanyon.com/dotnet/#Re...

When I start "server" & "client" all in my computer, it works well.

If I put "server.exe" in Computer A and put "client.exe" in Computer
B, I got a Web Exception. (cant not connect to remote server.)

Help me, please ^^

in server side:
server.exe, calcif.dll, server.exe.config

server.exe.config:
<!-- server.exe.config -->
<configuration>
<system.runtime.remoting>
<customErrors mode="off"/>
<application name="calcsrv">
<service>
<wellknown mode="Singleton" type="Calc, server"
objectUri="calc" />
</service>

<channels>
<channel ref="http" port="999">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/> <!-- On
the 1.1 runtime, add typeFilterLevel='Full' to the formatter element
-->
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>


in client:
client.exe, calcif.dll, client.exe.config

client.exe.config:
<!-- client.exe.config -->
<configuration>
<appSettings>
<add key="calcURL" value="http://MYSERVER:999/calcsrv/calc"/>
</appSettings>

<system.runtime.remoting>
<application name="client">
<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
3 Answers

Ken Kolda

9/22/2004 7:31:00 PM

0

OK -- first, the obvious: your client's config file refers to
http://MYSERVER:999 -- is MYSERVER the name of the client machine or the
server machine? If it's the client, then that would explain why it works
when the server is running on the client machine and not when on a different
machine -- you need to change MYSERVER to be the server's name/IP.

Assuming that's not the problem, the next thing to realize is that because
this is a remoting events example, the app is going to have connections
going from both client to server and from server to client (when an event is
raised that the client subscribes to). You should try to determine which of
these connections is being refused. If, for example, your client is behind a
firewall or router that performs NAT, that would certainly explain this
error.

If, on the other hand, the error is with the client connecting to the
server, then the first thing to try is to telnet to port 999 on your server.
If you can't get there, it's a network issue -- make sure there's no
firewall, router, etc. blocking traffice to that port on the server. You can
run "netstat -a" on to server to verify it's listening on the port you
expect (999).

If none of that helps, you'll need to provide more info of exactly what's
happening on what line of code.

Good luck -
Ken


"Skyer" <skyer.tw@gmail.com> wrote in message
news:f25ed114.0409220920.39260466@posting.google.com...
> Dear all:
>
> I got a problem running Mike's remoting sample.
> http://www.bearcanyon.com/dotnet/#Re...
>
> When I start "server" & "client" all in my computer, it works well.
>
> If I put "server.exe" in Computer A and put "client.exe" in Computer
> B, I got a Web Exception. (cant not connect to remote server.)
>
> Help me, please ^^
>
> in server side:
> server.exe, calcif.dll, server.exe.config
>
> server.exe.config:
> <!-- server.exe.config -->
> <configuration>
> <system.runtime.remoting>
> <customErrors mode="off"/>
> <application name="calcsrv">
> <service>
> <wellknown mode="Singleton" type="Calc, server"
> objectUri="calc" />
> </service>
>
> <channels>
> <channel ref="http" port="999">
> <clientProviders>
> <formatter ref="binary" />
> </clientProviders>
> <serverProviders>
> <formatter ref="binary" typeFilterLevel="Full"/> <!-- On
> the 1.1 runtime, add typeFilterLevel='Full' to the formatter element
> -->
> </serverProviders>
> </channel>
> </channels>
> </application>
> </system.runtime.remoting>
> </configuration>
>
>
> in client:
> client.exe, calcif.dll, client.exe.config
>
> client.exe.config:
> <!-- client.exe.config -->
> <configuration>
> <appSettings>
> <add key="calcURL" value="http://MYSERVER:999/calcsrv/calc"/>
> </appSettings>
>
> <system.runtime.remoting>
> <application name="client">
> <channels>
> <channel ref="http" port="0">
> <clientProviders>
> <formatter ref="binary" />
> </clientProviders>
> <serverProviders>
> <formatter ref="binary" />
> </serverProviders>
> </channel>
> </channels>
> </application>
> </system.runtime.remoting>
> </configuration>


skyer.tw

9/23/2004 3:59:00 AM

0

Ken, Thanks ^^

1. Because the server in not mine, I modify the server. Sorry ^^b.
2. My client is private ip, It means that I cant use "Remoting event"
tech ?
But I let my classmate testing. He has fixed ip, and get the same
error like me.
3. Because I use Tranditional Chinese XP (I'm from Taiwan), my error
message is Chinese. I try to use my pool English to explain ^^bb

Server side: server.exe output message..
Host stated. Please ENTER to exit.
Firing magic number event.
Failed to fire event.
(Chineses exception message) ==> connection has closed. cant connect
to remote server.

Client side: client.exe output message
c.AppDomainName (Calc) = Server.exe

Visual Studio .NET 2003 IDE:
Stop at line 108: Console.WriteLine("2 + 2 (Calc) = {0}", c.add(2,
2));

--
With BEST Regards,
Skyer

Ken Kolda

9/23/2004 3:35:00 PM

0

If your client is on a different local network than your server or behind
any kind of proxy/router/firewall, then using events with remoting becomes
difficult. That's because when an event is raised, the server actually
connects to the client using the IP address supplied by the client when it
subscribed to the event. That IP address will be the IP as known by the
client, so if it's in its own LAN and has an IP of 10.1.1.35, that's what it
passes. If the server's on a different network, then when it attempts to
connect to 10.1.1.35, it won't succeed since, from the server's perspective,
that IP address is meaningless.

If your client has a static mapping to a publicly accessible IP, then this
can be worked around using the second technique described in the following
article:

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

If not, then you should probably consider a third-party solution such as the
GenuineChannels product. This product replaces the native .NET remoting
channels with ones that can handle events across different subnets.

Hope that helps -
Ken


"Skyer" <skyer.tw@gmail.com> wrote in message
news:f25ed114.0409221959.21b23ca2@posting.google.com...
> Ken, Thanks ^^
>
> 1. Because the server in not mine, I modify the server. Sorry ^^b.
> 2. My client is private ip, It means that I cant use "Remoting event"
> tech ?
> But I let my classmate testing. He has fixed ip, and get the same
> error like me.
> 3. Because I use Tranditional Chinese XP (I'm from Taiwan), my error
> message is Chinese. I try to use my pool English to explain ^^bb
>
> Server side: server.exe output message..
> Host stated. Please ENTER to exit.
> Firing magic number event.
> Failed to fire event.
> (Chineses exception message) ==> connection has closed. cant connect
> to remote server.
>
> Client side: client.exe output message
> c.AppDomainName (Calc) = Server.exe
>
> Visual Studio .NET 2003 IDE:
> Stop at line 108: Console.WriteLine("2 + 2 (Calc) = {0}", c.add(2,
> 2));
>
> --
> With BEST Regards,
> Skyer