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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:29:07+00:00 2026-05-12T00:29:07+00:00

I have a WCF service with a private constructor. If I’m not wrong, constructors

  • 0

I have a WCF service with a private constructor. If I’m not wrong, constructors must be parameterless in WCF and the parameter I need is the caller’s name (or caller’s method name), so I can assign a few readonly fields.

Is there a way that I can get the caller’s name — or the method that invoked it? I was playing around with OperationContext.Current, but without any luck.

  • 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-12T00:29:07+00:00Added an answer on May 12, 2026 at 12:29 am

    I wouldn’t recommend accessing the stack trace for performance reasons.

    WCF service constructors only need to be parameterless if you are using the default ServiceHostFactory. You can specify a custom service factory in your .svc file like this:

    <%@ ServiceHost Language="C#" Debug="true"
       Service="Namespace.To.Service"
       Factory="Namespace.To.ServiceFactory" %>
    

    The process to creating your class in a custom way goes like this:

    1. Your ServiceHostFactory creates an instance of your custom ServiceHost in CreateServiceHost
    2. ServiceHost overrides OnOpening and adds a custom IServiceBehavior to Description.Behaviors (Description is a property on the base class)
    3. Your IServiceBehavior implements ApplyDispatchBehavior and enumerates serviceHostBase.ChannelDispatchers, checking if each is a ChannelDispatcher.
      • Each ChannelDispatcher’s Endpoints property is enumerated and it’s DispatchRuntime.InstanceProvider is changed to a custom IInstanceProvider
    4. The custom IInstanceProvider creates the instance in GetInstance

    I have used this to delegate creation to an IoC container.

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

Sidebar

Ask A Question

Stats

  • Questions 136k
  • Answers 136k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could create a subclass of DataGrid that internally stores… May 12, 2026 at 7:07 am
  • Editorial Team
    Editorial Team added an answer When you call Dns.GetHostEntry("") I'd think you'd get back a… May 12, 2026 at 7:07 am
  • Editorial Team
    Editorial Team added an answer In the MySQL C API, mysql_fetch_row returns a MYSQL_ROW object,… May 12, 2026 at 7:07 am

Related Questions

I have a WCF service with a private constructor. If I'm not wrong, constructors
I need to secure a WCF service that uses netTcpBinding and connects directly with
I'm not certain where the error is resulting (from silverlight, from wcf, something else...)
I have a WCF service that posts messages to a private, non-transactional MSMQ queue.
I have a complex RIA client that communicates with a WCF SOAP web service,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.