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

  • Home
  • SEARCH
  • 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 6072645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:10:58+00:00 2026-05-23T10:10:58+00:00

In my Azure web role code I have a CustomIdentity class derived from System.Security.Principal.IIdentity

  • 0

In my Azure web role code I have a CustomIdentity class derived from System.Security.Principal.IIdentity. At some point .NET runtime tries to serialize that class and serialization wouldn’t work. Trying to resolve that I searched a lot and found this answer and tried to inherit my class from MarshalByRefObject.

Now once my CustomIdentity class inherits from MarshalByRefObject there’re no serialization attempts anymore and my code works. However I’d like to know the performance implications of using MarshalByRefObject class.

My code runs like this. First the request comes to IIS and is passed to the authentication code that creates an instance of CustomIdentity and attaches that instance to HTTP context. Then some time later the same HTTP context is passed to the ASP.NET handler that accesses that CustomIdentity instance at most once. The CustomIdentity object lives for the duration of request and is then destroyed.

Now with serialization my CustomIdentity would be serialized into a stream, then deserialized from that stream into a new object. With MarshalByRefObject there’s no serialization but a proxy is created and the access will be marshaled via RPC to where the actual object resides.

How expensive will using MarshalByRefObject be in this scenario? Which – MarshalByRefObject or serialization – will be more costly?

  • 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-05-23T10:10:59+00:00Added an answer on May 23, 2026 at 10:10 am

    MarshalByRefObject means that all calls (methods, properties, etc) are proxied over the wire. This potentially means that instead of transferring the data once and then running multiple methods etc locally on the transferred data, you are making a network call every access. How many times (per request) is a role tested, for example? or the name queried? I honestly don’t know, but I’m guessing it is more than 1 (all totalled). Plus the original setup costs…

    The bandwidth probably won’t be significant, but latency is very significant, especially if you have distributed nodes (since you mention a cloud scenario).

    Personally, I would avoid MarshalByRefObject like the plague, but up to you…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Azure web role (MVC 3 project) wont' start with Twilio controller class I have
I'm playing with this Azure web role sample . It contains a class derived
We have a Web Role that we are hosting in Windows Azure that uses
I published a Azure Web Role from Visual Studio and something went wrong. I
I have a WCF Data service hosted in Azure as a Azure Web Role.
I have a relatively low bandwidth Azure Web Role application and also several processes
I have a WCF service that's deployed as a Windows Azure Web Role. I'm
We have an windows Azure web role (typically ASP.NET application) with client side J-queries
We have an ASP.NET MVC3 based Web role running on the Azure cloud, using
I want to make my Azure web role scalable in a self-contained manner. All

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.