Question

I'm using .NET remoting to communicate between a web site and a Windows service. They both live on different machines. I have a statically defined port number for use by all requests and responses.

I also use this mechanism to transfer files from the web site to the Windows service box. I'm passing a Stream object in the object that is being remoted to the Windows service box. The web box is opening another, seemingly random, port to facilitate this request that includes the file Stream.

Is there a way to specify which port this file Stream should use? Anyone know why it doesn't want to use the port I have defined and that all my other requests/responses use with no problem?

I'm using .NET Framework v2.

Was it helpful?

Solution

Just read your stream into a byte[] then pass that. Exactly what I did when came across this situation.

OTHER TIPS

Here is someone who has implemented file transfer with .NET remoting:

http://www.codeproject.com/KB/dotnet/Net_Remoting_Events.aspx

Source code is available from a link on the page.

However, I agree with the comment from John Saunders that you should move to WCF.

Add a method to your remoting object to return a Stream.

Just remember to dispose of it correctly by enclosing it in a using clause.

Use "remoting callbacks" passing a "stream like" remote object as parameter.

http://www.codeproject.com/Articles/1584/Using-the-Remoting-Callbacks-in-Net-Applications

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top