Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8710805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:43:12+00:00 2026-06-13T04:43:12+00:00

I’m returning Streams from a remote service ( .NET Remoting ). But Streams are

  • 0

I’m returning Streams from a remote service (.NET Remoting). But Streams are also disposables which as we all know are ment to be disposed.

I could call Dispose on the client side once I finished consuming those. However, I would like to know what exactly happens under the cover when I return a Stream from a remote object.

Especially:

  1. Should I better read everything into a byte[] and return that instead of a Stream?
  2. Or is .NET remoting doing exactly that for me under the covers anyway?
  3. If not, how is returning a Stream different from returning a byte[]? In the end, .NET Remoting must somehow serialize the data anyway?
  4. Does calling Dispose on the client side even has any affect at all? Is there any magical connection between the object on the client side and the object on the serverside? I think once it’s deserialized behind the covers, there is no sense in calling Dispose() on the client side or is there?

I’m answering to Mike Bild here because I also want to improve the question a little

Ok, so the stream talking back to the server is (for me at least) unexpected.

To cosume a remote object one has to do something like this:

public static class ServiceFactory <T>
{   
    public static T CreateProxy()
    {
        Type interfaceType = typeof(T);

        string uri = ApplicationServer.ServerURL + interfaceType.FullName;

        return (T)Activator.GetObject(interfaceType, uri);
    }
}

So you are explicitly reaching out for a specific remote object at some URI to consume. And when a method on that remote object returns an object that inherits from MarshallByRefObject that means it automatically is associated with the object on the remote side? Ok, that should be easy to reproduce with a test object I build myself. So this also means I should call Dispose on the client side and it get’s proxied back to the object on the server side?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:43:13+00:00Added an answer on June 13, 2026 at 4:43 am

    A Stream is a MarshalByRefObject. Thats a special kind. It’s a proxy.

    1. You can work with both in .NET remoting
    2. No, it’s an other type
      over a generated proxy – look for inheritance from
      MarshalByRefObject
    3. http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx
    4. Yes, a little bit magic over the proxy class
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.