7

I created a DD4T project from scratch including ASP.NET MVC 4 website, I copied all files (lib, conf & license included) from DD4T template but when I deploy the solution there is a problem related to the Routes;

The request for 'Page' found the following correspondents : 
DD4T.Web.Mvc.PageController
MyProject.Web.DD4T.PageController

I don't understand why I should need to define a namespace in routes.MapRoutes() while it's not required in the DD4T template here.

It looks like Unity is responsible of this, but why ? Here is my web.config :

<unity>
<typeAliases>
  <!-- Lifetime manager types -->
  <typeAlias alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager,                      Microsoft.Practices.Unity" />
  <typeAlias alias="external" type="Microsoft.Practices.Unity.ExternallyControlledLifetimeManager,                      Microsoft.Practices.Unity" />
  <!-- define aliases for interfaces -->
  <typeAlias alias="IPageProvider" type="DD4T.ContentModel.Contracts.Providers.IPageProvider, DD4T.ContentModel.Contracts" />
  <typeAlias alias="IComponentProvider" type="DD4T.ContentModel.Contracts.Providers.IComponentProvider, DD4T.ContentModel.Contracts" />
  <typeAlias alias="IBinaryProvider" type="DD4T.ContentModel.Contracts.Providers.IBinaryProvider, DD4T.ContentModel.Contracts" />
  <typeAlias alias="ILinkProvider" type="DD4T.ContentModel.Contracts.Providers.ILinkProvider, DD4T.ContentModel.Contracts" />
  <typeAlias alias="ITaxonomyProvider" type="DD4T.ContentModel.Contracts.Providers.ITaxonomyProvider, DD4T.ContentModel.Contracts" />
  <typeAlias alias="IComponentPresentationRenderer" type="DD4T.Mvc.Html.IComponentPresentationRenderer, DD4T.Mvc" />
  <typeAlias alias="IPageController" type="DD4T.Mvc.Controllers.IPageController, DD4T.Mvc" />
  <typeAlias alias="IComponentController" type="DD4T.Mvc.Controllers.IComponentController, DD4T.Mvc" />
  <typeAlias alias="IPageFactory" type="DD4T.ContentModel.Factories.IPageFactory, DD4T.ContentModel.Contracts" />
  <typeAlias alias="IComponentFactory" type="DD4T.ContentModel.Factories.IComponentFactory, DD4T.ContentModel.Contracts" />
  <typeAlias alias="ILinkFactory" type="DD4T.ContentModel.Factories.ILinkFactory, DD4T.ContentModel.Contracts" />
  <!-- 
    Define aliases for implementations 
    This is where we determine which classes to use for our implementations!
  -->
  <typeAlias alias="PageProvider" type="DD4T.Providers.SDLTridion2011sp1.TridionPageProvider, DD4T.Providers.SDLTridion2011sp1" />
  <typeAlias alias="ComponentProvider" type="DD4T.Providers.SDLTridion2011sp1.TridionComponentProvider, DD4T.Providers.SDLTridion2011sp1" />
  <typeAlias alias="BinaryProvider" type="DD4T.Providers.SDLTridion2011sp1.TridionBinaryProvider, DD4T.Providers.SDLTridion2011sp1" />
  <typeAlias alias="LinkProvider" type="DD4T.Providers.SDLTridion2011sp1.TridionLinkProvider, DD4T.Providers.SDLTridion2011sp1" />
  <typeAlias alias="TaxonomyProvider" type="DD4T.Providers.SDLTridion2011sp1.TridionTaxonomyProvider, DD4T.Providers.SDLTridion2011sp1" />
  <typeAlias alias="ComponentPresentationRenderer" type="DD4T.Mvc.Html.DefaultComponentPresentationRenderer, DD4T.Mvc" />
  <typeAlias alias="PageController" type="Test.Web.DD4T.PageController, Test.Web.DD4T" />
  <typeAlias alias="ComponentController" type="Test.Web.DD4T.ComponentController, Test.Web.DD4T" />
  <typeAlias alias="PageFactory" type="DD4T.Factories.PageFactory, DD4T.Factories" />
  <typeAlias alias="ComponentFactory" type="DD4T.Factories.ComponentFactory, DD4T.Factories" />
  <typeAlias alias="LinkFactory" type="DD4T.Factories.LinkFactory, DD4T.Factories" />
</typeAliases>
<!-- Unity Configuration -->
<containers>
  <container name="main">
    <types>
      <!-- map the implementations to the interfaces -->
      <type type="IPageProvider" mapTo="PageProvider">
        <!--          <lifetime type="singleton" /> -->
        <property name="PublicationId" type="int" value="0" />
      </type>
      <type type="IPageFactory" mapTo="PageFactory">
        <property name="PageProvider" dependencyType="IPageProvider" />
        <property name="ComponentFactory" dependencyType="IComponentFactory" />
        <property name="LinkFactory" dependencyType="ILinkFactory" />
      </type>
      <type type="ILinkProvider" mapTo="LinkProvider" />
      <type type="ILinkFactory" mapTo="LinkFactory">
        <property name="LinkProvider" dependencyType="ILinkProvider" />
      </type>
      <type type="IPageController" mapTo="PageController">
        <property name="PageFactory" dependencyType="IPageFactory" />
        <property name="ComponentPresentationRenderer" dependencyType="IComponentPresentationRenderer" />
      </type>
      <type type="IComponentProvider" mapTo="ComponentProvider">
        <lifetime type="singleton" />
      </type>
      <type type="IComponentFactory" mapTo="ComponentFactory">
        <lifetime type="singleton" />
        <property name="ComponentProvider" dependencyType="IComponentProvider" />
      </type>
      <type type="IComponentController" mapTo="ComponentController">
        <property name="ComponentFactory" dependencyType="IComponentFactory" />
      </type>
      <type type="IComponentPresentationRenderer" mapTo="ComponentPresentationRenderer">
        <lifetime type="singleton" />
      </type>
    </types>
  </container>
</containers>

2
  • 1
    isn't that configured in your dependency resolver? for the sample website that is Unity, see the <unity> section in the Web.config Commented May 3, 2013 at 8:15
  • Yes it is, I don't understand why I have all these problems with Unity, I almost copy-paste the web.config file
    – Giu Do
    Commented May 3, 2013 at 8:17

1 Answer 1

6

Unity wasn't working because I forgot tridion dlls

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.