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 8439945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:08:52+00:00 2026-06-10T08:08:52+00:00

Is it advisable to use singleton pattern in wcf application?. I have ServiceResponse class

  • 0

Is it advisable to use singleton pattern in wcf application?. I have ServiceResponse class which will take care the response and errordetail and almost all the details of the wcf current request. When i first hit the service, lets say i have 5 properties in ServiceResponse class and which got filled with respective values and some error details in errordetail property. For the next hit, lets say i dont get any error details and all other 4 properties got filled up.

But the thing here is, the errordetail property is still populated with the previous values which i assume the singleton object doesnt get created even after the subsequent hits. So only changed values got affected but untouched property still holds the previous value for the subsequent hits.

is it because the appdomain never get unloaded to release the object to allow the next sinleton object to get created for the other imm. request? How to acheive the singleton pattern in wcf otherwise. Appreciate the help.

  • 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-10T08:08:54+00:00Added an answer on June 10, 2026 at 8:08 am

    The singleton pattern implies that the object is only instantiated once and lives for the entire lifetime of the AppDomain. You should not store data that is specific to a given request in static objects because all of them will share the same data which might not be what you are looking for.

    Whether it is a good idea or not to use static objects in a WCF application is a question that will entirely depend on your scenario and what you need to store there. Since WCF is a multithreaded environment where multiple threads could access this shared data you will have to take special care to ensure that this data is thread safe by using the proper synchronization mechanisms.

    is it because the appdomain never get unloaded to release the object
    to allow the next sinleton object to get created for the other imm.
    request?

    There’s a single AppDomain that gets created when your application starts. Don’t expect to get a different AppDomain on each request. Requests will all be served from the same AppDomain until the application gets recycled by IIS.

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

Sidebar

Related Questions

In one of the financial Winform projects , the application code will have to
It is advisable to use tables in HTML pages (now that we have CSS)?
My MVC application contains a parent model, which will contain 1 or more child
Is it possible to have an usercontrol(.ascx) in class libaray(dll) and use the control
It seems that it is not advisable to use <meta http-equiv=REFRESH CONTENT=3;url=url> for redirects
Is it possible (or even advisable) to use a PriorityExecutorBasedEventDrivenDispatcher with a TypedActor, in
Using local variables seems advisable in a partial that could be used application-wide to
Is it advisable to implement url routing for an asp.net(webforms) website which is one
I've read that system(pause) is slow and not advisable to use. Is there any
Is it advisable for my own DAO class to throw a SecurityException in its

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.