Azure PaaS applicationInitialization gotcha with EXM hostname mapping

Mark Gibbons
1 min readAug 2, 2019

--

Battling with EXM not mapping your hostname correctly? Does it intermittently choose the wrong URL or use http://localhost? Read on!

Occasionally I was having an issue after deployments or CM restarts where EXM would stop working. Checking the logs would give this kind of thing:

ERROR Exception: Sitecore.EmailCampaign.Model.Web.Exceptions.NonCriticalException Message: Failed to download string content, URL: http://localhost/..., Use IIS Credentials: True, UserAgent: ECM Dispatch Source: Sitecore.EmailCampaign

Chatting to Sitecore Support they mentioned:

The hostname for that URL is set on the first request to the server, so it may be different after every server restart thus giving different responses.

I had an epiphany as I had recently made changes to the applicationInitialization config as per findings from Richard Szalay’s excellent blog post. I had removed the hostName value and instead set it to use

<add initializationPage="/?sc_site=website" />

So I simply added the CM’s hostname and gave it a test (restart and slot-swap)

<add initializationPage="/?sc_site=website" hostName="www.yours.com" />

Voila! Fixed!

Other Things To Try

I realise that some people might come here hoping for other things to try if the above is not applicable or doesn’t solve the issue.

  • You need to have your EXM.RendererUrl setting set to your CM hostname
  • You can try add Hostname Mappings (in /sitecore/settings) for your CM hostname and CM staging slot hostname

--

--

Mark Gibbons
Mark Gibbons

Written by Mark Gibbons

Technical Architect @ Aceik | Sitecore Technology MVP 2020 - 2024 with a love for all things #Sitecore / Twitter twitter.com/markgibbons25

No responses yet