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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:54:28+00:00 2026-05-25T17:54:28+00:00

My Interfaces are in a seperate project, and I’m guessing I have to do

  • 0

My Interfaces are in a seperate project, and I’m guessing I have to do something special when I am registering my services etc. in windsor.

The error I am getting is:

Type ABC.Interfaces.Services.IUserService is abstract.
As such, it is not possible to instansiate it as implementation of service ABC.Interfaces.Services.IUserService.

My installer:

 public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                    AllTypes.FromAssemblyContaining<UserService>()
                    .BasedOn<IUserService>()
                    .Where(type => type.Name.EndsWith("Service"))
                    .WithService.DefaultInterface()
                    .Configure(c => c.LifeStyle.Singleton));
        }

    container.Register(
                    AllTypes.FromAssemblyContaining<UserRepository>()
                    .BasedOn<IUserRepository>()
                    .Where(type => type.Name.EndsWith("Repository"))
                    .WithService.DefaultInterface()
                    .Configure(c => c.LifeStyle.PerWebRequest)
                    );

I was getting the error, and then I added the .BasedOn<....>() clause as I figured it has to do with my interfaces being in a separate project (and thus assembly) as the actual implementation.

Do I have to tell castle the assembly of that interface?
Or is something else the issue?

Update II

My code:

public class HomeController : Controller
{
        private IUserService _userService;

        public HomeController(IUserService userService)
        {
            this._userService = userService;
        }

}

In services assembly:

public class UserService : IUserService
    {
        private IUserRepository _repository;

        public UserService(IUserRepository repository)
        {
            this._repository = repository;
        }


        public void Create(IUser user)
        {
            _repository.Create(user);
        }
        public IUser Get(int id)
        {
            return _repository.Get(id);
        }

    }

In interfaces assembly:

public interface IUserService
{
        void Create(IUser user);
        IUser Get(int id);
}
  • 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-25T17:54:29+00:00Added an answer on May 25, 2026 at 5:54 pm

    The problem is that BasedOn, Where, and Pick do logical or

    So this code:

    AllTypes.FromAssemblyContaining<UserService>()
        .BasedOn<IUserService>()
        .Where(type => type.Name.EndsWith("Service"))
    

    Will select all types that are based on IUserService, or end with Service. The type IUserService ends with Service, so it gets selected for registration.

    To solve this, you can remove the EndsWith("Service") filtering. It probably isn’t necessary anyway. Or you could remove the BasedOn filter, and move similar logic to the Where clause:

    AllTypes.FromAssemblyContaining<UserService>()
        .Where(type => type.Name.EndsWith("Service")
            && typeof(IUserService).IsAssignableFrom(type))
        .WithService.DefaultInterface()
        .Configure(c => c.LifeStyle.Singleton)
    

    Also, you say the types are in different assemblies, but it seems somehow you are grabbing types out of the assembly that IUserService lives in.

    Check out this question for a way to debug which services are getting registered by your code.

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

Sidebar

Related Questions

There must be something fundamental about interfaces/generics I have not yet learned. I hope
interfaces provide a useful abstraction capability. One can have a class Foo implement some
I have created an OrderFormViewModel which looks something like public class OrderFormViewModel { public
We currently have quite a few classes in a project, and each of those
On my ASP.NET MVC 3 project, I have implemented the repository pattern inside a
I have a little Android project going on which involves some IPC where client
I’m having a little Architecture problem. In my project I have a Business Logic
Say I have a web project which uses a WCF service for behind-the-scenes processing,
I'm trying to see if I understand depedency injection. I have a project that
We have a framework that defines many interfaces and some basic default implementations. Let's

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.