I am trying to patch the initialize pipeline to add a processor. I simply add the following config (obtained from a KB article here) in include folder:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor type="MyNamespace.CustomProcessor, MyAssembly" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>

It produces the following error even when I hit the show-config page:

Could not get pipeline: initialize (domain:

This patch file also produces same error:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">


The file is located at: \App_Config\Include\Z.Customizations\ z_InitializePipeline.config

There is no folder after Z.Customization, So based on the answer by @Zachary Kniebel, it should be the last file to be applied.

Something I noticed is that when I move the file to Include folder, the error changes to Could not get pipeline: preprocessRequest (domain: )

This may be normal since it is not the last file to be processed for sure.

  • If you perform a domain/sitecore/admin/showconfig.aspx and look for the <initialize> pipeline, what is displayed? – Pete Navarra Oct 26 '16 at 16:20
  • 1
    He can't Pete. "It produces the following error even when I hit the show-config page" – Mark Cassidy Oct 26 '16 at 16:23
  • Sorry, I missed that part. Seems like either something is messed up with the Sitecore.config or maybe the Sitecore.Mvc.config isn't enabled? – Pete Navarra Oct 26 '16 at 16:26
  • Sitecore.Mvc.config should be enabled because I'm already using web API and MVC controllers in the project. Also, when I add my processor directly in the Sitecore.config file, everything works as expected. – Maziar Rezaei Oct 26 '16 at 16:39

The fix

There are invisible characters in the configuration file; this is something that may happen when you copy configuration text directly from a web page. Remove the characters and the issue will be fixed.

Here they are, at the end of the line:


You can make them visible in different ways, but the easiest that has worked for me was to:

  1. Open the file with Notepad++;
  2. Convert the file to ASCII via the menu Encoding –> Encode in ASCII.

Where did they come from?

Now, let's look into the page where this invisible characters appeared. Here's the relevant part of the source code of the KB article, as seen through Chrome Dev Tools:

<pre class="prettyprint">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"&gt;
        &lt;processor type="<strong>MyNamespace.RegisterCustomRoute, MyAssembly</strong>"  patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc'] /&gt;

See it now? It's &zwnj; - the zero-width non-joiner character.

It's not added there by JavaScript (I checked), which means it was the author of the article who put it there accidentally. Most likely, it's coming from some text editing software.

  • 4
    Nailed it :-) Also note; the KB article linked actually has an error in the XML config snippet. It lacks closing quotes near the very end. – Mark Cassidy Oct 26 '16 at 16:50
  • @MarkCassidy I already saw that. The file is definitely hunted – Maziar Rezaei Oct 26 '16 at 17:35
  • 1
    I think the author of that article should buy Dmytro a beer every time this answer gets upvoted! Thanks for the solution. – Paul George Dec 12 '16 at 18:08

This is going to sound silly; but rename your config file to zzzz.patch.config - it will work.

Sitecore patches in these configs in a certain order (alphabetically, but that's a simplified explanation). Looks like your config comes in before the Sitecore.MVC.config file, and the patch therefore fails.

A more comprehensive explanation of how this works can be found here: Organising your Sitecore Patch Include Files

  • Thanks, but this doesn't seem to be the issue. The path to the file is: \App_Config\Include\Z.Customizations\ z_InitializePipeline.config – Maziar Rezaei Oct 26 '16 at 16:13
  • 1
    Interesting... ok. First thing to test: If you rename your config to .disabled (effectively disabling it), are you able to get ShowConfig.aspx to show the full configuration? It looks like there may be some malformed XML in there somewhere - and it doesn't seem to be the config file you pasted here. – Mark Cassidy Oct 26 '16 at 16:19
  • Mark beat me to asking it ;) – Zachary Kniebel Oct 26 '16 at 16:20
  • If I add .disabled, everything works. I should add that I do restart IIS between moving or renaming files or any modifications I do to make sure that everything is re-parsed – Maziar Rezaei Oct 26 '16 at 16:30
  • 1
    @ZacharyKniebel Sitecore doesn't, asp.Net does - it will reload the app domain upon detecting an configuration or relevant file change. Reloading the app domain is quicker that recycling the entire app pool and also keeps the existing worker process, whereas recycling starts a new one. – Paul George Oct 26 '16 at 21:54

Like @Mark Cassidy said, you need to make sure that your patch is added after all of the other patches, and patch files are added alphabetically.

I prefer to put all of my patches into a folder, named zzzPatches. The reason for this is because while both files and folders are patched in alphabetically, folders are patched in AFTER files. As such, I prefix my folder name with z to make sure that it is added in after all of the other folders and files.


  • App_Config\Include files are patched alphabetically
  • App_Config\Include sub-directories are patched in alphabetically
  • App_Config\Include sub-directories are always patched in AFTER files in the same directory
  • Patch file named "zzzPatch.config" will be patched in after all other files in the same directory (so long as they their name comes before zzzPatch alphabetically)
  • Patch sub-directory named zzzPatches will be patched in after all files and after all other sub-directories in the same directory (so long as the other sub-directories' names come before zzzPatches alphabetically)
  • Thanks, but this doesn't seem to be the issue. The path to the file is: \App_Config\Include\Z.Customizations\ z_InitializePipeline.config – Maziar Rezaei Oct 26 '16 at 16:13

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.