PROBLEM: Received the below error at runtime:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred while parsing EntityName. Line 86, position 346.
Source Error:
Source File: C:\Dev\mywebsite\web.config Line: 86
SOLUTION: Pretty straight forward case of an XML element that needed replacing in my web.config file https://stackoverflow.com/a/23542105/1450351 - in my case it was ampersand in a URL, so replaced with & ... BUT what wasn't simple was that this was that to handle local secrets and prevent them going into source control we use:
<appSettings file="Web.secrets.config">
(This approach is taken from https://www.hanselman.com/blog/best-practices-for-private-config-data-and-connection-strings-in-configuration-in-aspnet-and-azure and https://stackoverflow.com/a/60961168/1450351 (we did consider using SlowCheetah but it is only appropriate for app.config files e.g. with console apps))
INTERESTING SIDE NOTE: Because I like being able to quickly copy and paste passwords (yes ideally we should be using Azure Key Vault or similar), when I'm creating new passwords I'll explicitly avoid certain characters which needs replacing or escaping in web.config files or other places. So I opt for a really long password that uses only a subset of special characters e.g. $ # % -
...the complication this causes is that the error message refers to web.config but the problem was actually in web.secrets.config ... so when I looked at line 86 in the web.config I couldn't see an issue - and even when I deleted line 86 the issue still remained - because it was referring to line 86 of the web.secrets.config file (the two files kind of merge at run time, with any app settings in the secrets file overriding anything that exists in web.config).
Anyway, luckily I checked the secrets file and saw the issue.
INTERESTING SIDE NOTE: Because I like being able to quickly copy and paste passwords (yes ideally we should be using Azure Key Vault or similar), when I'm creating new passwords I'll explicitly avoid certain characters which needs replacing or escaping in web.config files or other places. So I opt for a really long password that uses only a subset of special characters e.g. $ # % -