1

XHR requests in my publishing service are returning 404 with messages that resource could not be found:

{
  "Message": "No HTTP resource was found that matches the request URI 'http://instance/sitecore/api/ssc/publishing/Targets/{00000000-0000-0000-0000-000000000000}/All'.",
  "MessageDetail": "No type was found that matches the controller named 'Targets'."
}

It's similar to what has been reported here: Sitecore Publishing Service does not show the languages and seeing 404 errors yet solutions from there doesn't seem to help.

It is not working on some environments and locally, where recently I have changed way for handling DI. Basically, before we had been using DefaultServiceProviderBuilder.

We wanted to be able to use our Castle Windsor dependencies in pipeline processors and such, so I've implemented custom Service Provider Builder (using https://github.com/volosoft/castle-windsor-ms-adapter):

public class WindsorServiceProviderBuilder : BaseServiceProviderBuilder
{
    protected override IServiceProvider BuildServiceProvider(IServiceCollection serviceCollection)
    {
        ContainerManager.InitContainer(new WindsorContainer());

        ContainerManager.Container.Install(FromAssembly.InThisApplication());
        ContainerManager.Container.Register(Classes.FromThisAssembly().BasedOn<IController>().LifestyleTransient());

        return WindsorRegistrationHelper.CreateServiceProvider(ContainerManager.Container, serviceCollection);
    }
}

When this is in place, everything seems to be working fine when it comes to Sitecore and the application itself, but it's the publishing service that has issues. When publishing an item from content editor, dialog is not populated with targets and languages and the same happens on publishing dashhboard - no running jobs, recent jobs etc. Just the 404 error in the console.

When going to /sitecore/admin/ShowServicesConfig.aspx?details=1, I can't see on the first sight that something is missing.

When switching back to the previous service provider (default one), things are working fine. But the overriden one doesn't seem to be working. What might be missing here?

2
  • 1
    You need to have a solid and good reason not to use Sitecore's ootb Microsoft dependency injection. Without pulling your hair out, I'll recommend switching back. Commented Aug 12, 2019 at 10:11
  • Another thing you can also try, is to ensure that HttpContextBase is registered and implemented correctly with your IoC container. Commented Sep 11, 2019 at 11:33

1 Answer 1

1

The Publishing Service Controllers are Web API Controllers and Web API caches these controller types in the following auto generated file:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\XXXXXXXX\XXXXXXXX\UserCache\MS-ApiControllerTypeCache.xml

I know you said you'd followed the other thread advice but I've specifically seen this issue when this file is out of date.

If you open MS-ApiControllerTypeCache.xml in a text editor you should see the API controllers mentioned wrapped in an assembly element such as:

<assembly name="Sitecore.Publishing.Service.Client.Services, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null">
    <module versionId="b178e91f-1703-48ed-8c02-3681d90dbfd1">
         <type>Sitecore.Publishing.Service.Client.Services.Controllers.PublishingItemDetailsController</type>
         <type>Sitecore.Publishing.Service.Client.Services.Controllers.PublishingTargetsController</type>
         <type>Sitecore.Publishing.Service.Client.Services.Controllers.PublishingMaintenanceController</type>
         <type>Sitecore.Publishing.Service.Client.Services.Controllers.PublishingJobController</type>
         <type>Sitecore.Publishing.Service.Client.Services.Controllers.PublishingLanguageController</type>
     </module>
</assembly>

If the above XML is not present:

  • Stop IIS
  • Clear out the folder C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root
  • Restart IIS
  • Load the site in a browser
  • Check that the MS-ApiControllerTypeCache.xml file now has the controller types present.
1
  • MS-ApiControllerTypeCache.xml is empty - null, nothing, nada: <?xml version="1.0" encoding="utf-8"?> <!--This file is automatically generated. Please do not modify the contents of this file.--> <typeCache lastModified="12.08.2019 14:51:51" mvcVersionId="b2d5f889-b8d5-408c-a3d4-aa24eb5e947e" /> - that's the whole content.
    – jjczopek
    Commented Aug 12, 2019 at 12:52

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.