My .NET Core 5.0 web application is not working after publishing it. Error "Unhandled exception. System.TypeInitializationException: "
Your connection string is escaped improperly.
"ConnectionString": "Server=1**1\Manageengine;Database=ServiceDesk;Trusted_Connection=True;User ID=ad-***\tmsdb.****;Password=$***"
"ConnectionString": "Server=1**1\\Manageengine;Database=ServiceDesk;Trusted_Connection=True;User ID=ad-***\\tmsdb.****;Password=$***"
You need an extra
\ for two parts of that string. The
\M and the
\t need to be
JSON Parsing Issue - 'S' is an invalid escapable character within a JSON
ConnectionStrings. DefaultConnString field, you're escaping
SQLExpress;). As the error suggests, you can't do that.
You can fix this by adding another escape character (backslash,
\) in front of the pre-existing one. Backslashes are escapable characters and the end result will be the wanted one, you'll get one backslash in that position.
Upgraded to ASP.NET Core 3.1, getting error about System.Text.Json
The trick that solves 90% of the issues since Visual Studio 2002 ;-)
manually delete all bin and obj folders in your solution.
Error parsing JSON for network server name
It's hard to know exactly what your problem is without seeing the exact error message, but this sequence of characters at the beginning of your string looks wrong:
\ is used to escape the following character, then
\" will be interpreted as
\\ will be interpreted as
\. This leaves
\E which is not a valid escape sequence. I also don't think you need
\" at the beginning or end of your string, unless the code that uses this value expects the string to be "wrapped" with double quotes.
Try the following, and see if that resolves your parsing error:
More information on other valid escape sequences can be found here.