Constructor on type: "Namespace.type" not found
Asked Answered
M

1

2

I am using Castle.Windsor as an IOC.

So I am trying to resolve a service type in the constructor of an HTTPHandler. I keep receiving this error, "Constructor on type: "Namespace.type" not found." My configuration has the following entries for service type: IDocumentDirectory

<component id="restricted.content.directory" service="org.myorg.foundations.services.content.IDocumentDirectory, org.myorg.foundations.services" type="org.myorg.foundations.services.content.RestrictedLocalizationDocumentDirectory, org.myorg.foundations.services">
    <parameters>
      <contentDirectory>${content.directory}</contentDirectory>
      <localizations>
        <array>
          <item>en-us</item>
          <item>es-us</item>
        </array>
      </localizations>
    </parameters>
  </component>

  <component id="content.directory" service="org.myorg.foundations.services.content.IDocumentDirectory, org.myorg.foundations.services" type="org.myorg.foundations.services.web.client.WebServiceDocumentDirectory, org.myorg.foundations.services.web.client">
    <parameters>
      <webServiceURL>#{contentDirectoryWebsiteUrl}</webServiceURL>
    </parameters>
  </component>

In my new handler the constructor looks like this:

 public HeartBeatHttpHandler(IDocumentDirectory contentDirectory)
    {
        _contentDirectory = contentDirectory;
    }

I have never recieved this error using Castle.Windsor. Can someone explain?

Thanks!

Manchester answered 3/11, 2009 at 14:1 Comment(3)
What does the implementation of IDocumentDirectory provide?Dustcloth
is HeartBeatHttpHandler instance retrieved with windsor too ? if so, could you show the windsor component configuration for HeartBeatHttpHandlerRhombencephalon
What are the real value of "Namespace.type" in your error message ?Rhombencephalon
M
4

You cannot inject a dependency into managed .NET HTTPHandler code. The objects that implement IHttpHandler must have a parameter-less constructor.

I used an application container instead. Which wouldn't have been my first choice.

-Nick

Manchester answered 3/11, 2009 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.