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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:16:33+00:00 2026-05-24T21:16:33+00:00

I have the following simple interface: public interface IInitialisableWcfService { void Initialise(); } Which

  • 0

I have the following simple interface:

public interface IInitialisableWcfService
{
    void Initialise();
}

Which I’m placing on a class that’s being used as a WCF service like so:

public class LocalResourceManager : ILocalResourceManager, IInitialisableWcfService 

ILocalResourceManager is the interface that’s being used to set the binding configuration for the wcf endpoint.

Inside another class that we used for hosting WCF services on the fly, I have the following code that tests for the IInitialisableWcfService interface:

   private void Create(Type serviceType)
    {
        try
        {
            ServiceHost host = null;
            if (serviceType == typeof(IInitialisableWcfService))
            {
                // create object to initialize.
            }
            else
            {
                // do something else
            }

        catch (ThreadAbortException)
        {
            throw;
        }
        catch (Exception ex)
        {
           //log error
        }
    }

But this fails to match the LocalResourceManager manager service when it’s passed in, or indeed any other service that implements IInitialisableWcfService. I’ve also tried this

  if(serviceType is IInitialisableWcfService)

But that doesn’t work either.

I’m not sure what the issue is here. Three possibilities:

1) The syntax for checking and interface is wrong. I find this unlikely.

2) Because the WCF endpoint is registered with an ILocalResourceManager interface, the object is not exposing its IInitialisableWcfService over WCF

3) Passing around a Type rather than an actual class means you can’t check for interfaces

Or possibly none of the above. Assistance greatly appreciated.

Cheers,
Matt

  • 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-24T21:16:33+00:00Added an answer on May 24, 2026 at 9:16 pm

    The Type of serviceType is the actual concrete type that’s implementing the service, so you just need to check if the service type is assignable to the interface you want:

    if (typeof(IInitialisableWcfService).IsAssignableFrom(serviceType))
    {
        // Code here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
I have a simple console application where I have the following setup: public interface
If I have the following Interface structure; public interface IPaymentTypeBase { void PayNow(); double
I have a simple type that explicitly implemets an Interface. public interface IMessageHeader {
We have the following simple Stored Procedure that runs as an overnight SQL server
I have the following simple function: private void EnableDisable941ScheduleBButton() { if (this._uosDepositorFrequency.Value != null)
I have the following simple python test script that uses Suds to call a
i have the following simple script <input class=input type=text name=password style=color: #797272; value= <?php
I have defined the following Unit-Test: [TestMethod] //@Test for the Java crowd public void

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.