EXM Throws NonCriticalException "Failed to download string content" with Nested Exception of "403 Forbidden" in Azure Web App

 Upon previewing email content in Azure Web App, one could get the following error:

9668 03:27:56 ERROR Exception: Sitecore.EmailCampaign.Model.Web.Exceptions.NonCriticalException

Message: Failed to download string content, URL: https://testazure-cm.azurewebsites.net/?sc_itemid=%7B229384AB-6279-42BC-925F-1D28C0227C03%7D&sc_lang=en&sc_device=%7BFE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3%7D&ec_database=master&ec_id=96F0189C036942DDA62BCE8D68C6D1C7&ec_message_id=583137BAD51D4491AD8D07451BCC9000, Use IIS Credentials: True, UserAgent: ECM Dispatch

Source: Sitecore.EmailCampaign

   at Sitecore.Modules.EmailCampaign.Core.WebContent.DownloadString(String url, Boolean useIisCredentials, String userAgent)

   at Sitecore.Modules.EmailCampaign.Messages.WebPageMail.GetMessageBody(Boolean preview)

   at Sitecore.EmailCampaign.Cm.MessageInfo.FillContentEditorInfo()

Nested Exception

Exception: System.Net.WebException

Message: The remote server returned an error: (403) Forbidden.

Source: System

   at System.Net.HttpWebRequest.GetResponse()

   at Sitecore.Modules.EmailCampaign.Core.WebContent.DoDownloadString(String url, Boolean useIisCredentials, String userAgent)

   at Sitecore.Modules.EmailCampaign.Core.WebContent.DownloadString(String url, Boolean useIisCredentials, String userAgent)

One potential root cause of this error is the IP Restriction of that Server, especially when we allow the IP address of certain authoring user in that web app, such as:

It might sound little weird that a server cannot (is forbidden to) access itself (which is the logic of that EXM). This is the effect of the above IP address rule.

There are two solutions to this:

1. Allow any IP address (remove the existing rules that allow certain IP addresses)

2. Add its own "Outbound IP addresses" into the list of "Allowed" IP addresses which can be retrieved from the "Properties" tab (such as the part highlighted with a green box in the picture below).

Comments

Post a Comment

Popular posts from this blog

Added Contact Is Not Shown in List Manager in a Scaled Sitecore XP 9

Windows could not start the Sitecore Xconnect Search Indexer - {xConnectInstance}-IndexWorker service on Local Computer. Error 1064: An exception occurred in the service when handling the control request.