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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:34:03+00:00 2026-06-14T18:34:03+00:00

As a long time reader of StackOverflow but not finding the solution to my

  • 0

As a long time reader of StackOverflow but not finding the solution to my problem here is my first attempt to ask a question, so don’t be too harsh on me 🙂

I have the following WCF 4 REST service definitions:

Service contract

namespace RestService2.Service
{
    [ServiceContract]
    public interface ISampleService
    {
       [WebGet(UriTemplate = "")]
       List<SampleItem> GetCollection();

       [WebInvoke(UriTemplate = "", Method = "POST")]
       SampleItem Create(SampleItem instance);

       [WebGet(UriTemplate = "?id={id}")]
       SampleItem Get(int id);

       [WebInvoke(UriTemplate = "?id={id}", Method = "PUT")]
       SampleItem Update(int id, SampleItem instance);

       [WebInvoke(UriTemplate = "?id={id}", Method = "DELETE")]
       void Delete(int id);
    }
}

Service implementation

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class SampleService : ISampleService
{
    private IDatabase db;
    public SampleService(IDatabase db)
    {
        this.db = db;
    }

    public SampleService()
    {
    }
    public List<SampleItem> GetCollection()
    {
        return db.Items.Values.ToList();
    }

    public SampleItem Create(SampleItem instance)
    {
        // Add the new instance of SampleItem to the collection
        db.Items.Add(instance.Id, instance);
        return db.Items[instance.Id];
    }

    //..Rest omitted..
}

Database interface:

using RestService2.Entities;

namespace RestService2.Service
{
   public interface IDatabase
   {
      Dictionary<int, SampleItem> Items { get; }

   }
}

Database implementation:

public class Database : IDatabase
{
    private Dictionary<int, SampleItem> items;

    public Database()
    {
    }

    public Dictionary<int, SampleItem> Items
    {
        get
        {
            return items;
        }
    }
}

..and the global.asax file

namespace RestService2.Web
{
    public class Global : HttpApplication
    {
        static IWindsorContainer Container {get; set;}

        void Application_Start(object sender, EventArgs e)
        {
           BuildContainer();
           RegisterRoutes();
        }

        private void BuildContainer()
        {
           Container = new WindsorContainer();
           Container.AddFacility<WcfFacility>()
            .Register(Component.For<ISampleService>().ImplementedBy<SampleService>().Named("SampleService"))
            .Register(Component.For<IDatabase>().ImplementedBy<Database>());

        }
        private void RegisterRoutes()
        {
            RouteTable.Routes.Add(new ServiceRoute("SampleService",
            new DefaultServiceHostFactory(), typeof(SampleService)));
        }
    }
}

The service contract, service implementation, database interface and database implementation are in assembly A, SampleItem (an entity) is defined in assembly B and the global.asax.cs is in assembly C.

I have added references from assembly A and B to assembly C.

When I try to access the service help page (or any service method for that matter) I get the following error message: Could not find a component with type RestService2.Service.SampleService, RestService2.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, did you forget to register it?

Any idea what could be problem? How should i configure the container correctly?

Regards

  • 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-14T18:34:05+00:00Added an answer on June 14, 2026 at 6:34 pm

    I was able to build a REST service using the WCFIntegration facility, using both interfaces for registration and through the MVC routing mechanism.

    // SVC Routes
    routes.Add(new ServiceRoute("Example", new WindsorServiceHostFactory<RestServiceModel>(), typeof(IExample)));
    

    Remember to register the service/implementation in Windsor before calling RegisterRoutes (where this code would be). Additionally, make sure you call this route registration before your default route, otherwise that will be used instead.

    The service can then just be called via the route, ie:

    http://localhost:80/Core/Example/GetAll/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey! First post for me but long time reader of Stackoverflow. Anyway, got a
Long time stackoverflow reader, first time poster. Forgive me if I'm not asking a
Long time reader/ first time poster here, with a question I suspect will be
Longtime reader of stackoverflow but first question. I'm working with Wordpress (specifically thesis theme)
First time poster, long time reader. I've been having a problem with figuring this
long time reader, first time question-er. I've found myself in a unique situation, and
I have been a long time reader here and never posted but I was
long time reader/first time poster here. So I've got a checkbox array that posted
Long time reader, first time asker. Anyway, Here's the code I'm working with: class
long time reader, first time writer here. I'm trying to figure out all possible

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.