1
  1. SDL Web 8.5 Using DD4T Template Publishing to broker DB its working fine. URL and Page Content exist in relavant tables. By the timing we published into HTML file.
  2. Visual studio 2015 we created published to IIS in .Net application. Below setup added in Visual Studio solution.(DD4T.MVC5.2.2.4,DD4T.DI.Autofac.2.2.3,DD4T.Providers.SDLWeb8.5.CIL.2.2.2)
  3. Whenever creating Views in solution under TridionPage folder same name using which we used in Page Template Metadata.
  4. After trying access to the page but throwing error. "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable"
  5. When we tracking failed request tracing its showing attached error file.enter image description here

Kindly appreciate your help.

  • Have you checked you're CIL/CIS logs? – Neil May 21 '18 at 12:01
  • share your web app web.config using pastebin.com? – Velmurugan May 22 '18 at 7:39
  • Web Config URL pastebin.com/xDDSM6pi – Thoufik Ahamed May 22 '18 at 8:32
  • @ThoufikAhamed, web.config looks fine to me, I was suspecting your Global.asax.cs / PageController class ContainerBuilder and RegisterControllers stuffs something wrong, could you please update your question to share your Global.asax.cs and PageController class file – Velmurugan May 27 '18 at 10:30
  • @Velmurugan Kindly find requested file from this link pastebin.com/8ATphS8M – Thoufik Ahamed May 28 '18 at 5:45
1

Found the issue in your Global.ascx.cs file, The following below line wrong, it should register your PageController class not MvcApplication class

builder.RegisterControllers(typeof(MvcApplication).Assembly);

Corrected Global.ascx.cs file

public class MvcApplication : System.Web.HttpApplication
{
    ILifetimeScope BuildContainer()
    {
        var builder = new ContainerBuilder();
        builder.RegisterControllers(typeof(PageController).Assembly);
        builder.UseDD4T();
        return builder.Build();
    }
    protected void Application_Start()
    {
        var builder = BuildContainer();
        DependencyResolver.SetResolver(new AutofacDependencyResolver(builder));

        AreaRegistration.RegisterAllAreas();
        RouteConfig.RegisterRoutes(RouteTable.Routes);
    }
}

In DD4T 2 - Instead of TridionControllerBase you can also use ModelControllerBase for View Model Build using ViewModelFactory

public class PageController : ModelControllerBase
{

    public PageController(IPageFactory pageFactory, IComponentPresentationFactory componentPresentationFactory,
    ILogger logger, IDD4TConfiguration config, IViewModelFactory viewModelFactory)
        : base(pageFactory, componentPresentationFactory, logger, config, viewModelFactory)
    {

    }

    public ActionResult Page(string url)
    {
        url = !url.StartsWith("/") ? "/" + url : url;

        IPage page = GetPage(url);
        if (page == null) { 

            //TODO return 404 not found page
        }

        var pageViewModel = ViewModelFactory.BuildViewModel(page);

        return View(GetViewName(page), pageViewModel);
    }
}

I hope it helps to fix your issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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