Reputation: 447
I am getting this error while executing the application on server:
The configuration section cannot contain a CDATA or text element(web.config line 149).
The error lines are as follows:
<location path="admin">
<system.web>
<authorization>
<allow roles="Admin"/>
<deny users="*"/>;
</authorization>
</system.web>
</location>
Please help me in this error.
Upvotes: 39
Views: 75930
Reputation: 2310
This error occurs when you have a character or characters that are not allowed in your web.config file (like a semicolon, comma, etc.), or are missing a necessary character (like a missing apostrophe, assignment operator, etc.).
In your case, you have a semicolon at the end of this line:
<deny users="*"/>;
This semicolon is not allowed and is the reason you are getting that error.
Upvotes: 41
Reputation: 113
You may have unusual characters in you string like "\n" that you don't normally see in Visual Studio or NotePad++. Copy that in a simple text editor (like basic NotePad) and copy back to your file.
That fixed the issue for me.
Upvotes: -1
Reputation: 57
This error happens only when some wrong code or garbage code ingected mistakenly inside your config file like sometime mistakenly you missed to remove semicolon or wrong keyword inserted which is not accepted by config file you just need to read your file properly and after removing garbage code it will start working File is not showing compile time error but it will show runtime error like this.
Upvotes: 3
Reputation: 163
Avoid stray characters and spaces in web-config tags. I was doing everything right but my issue was I was having spaces which caused the issue.
Upvotes: 3
Reputation:
Usually this error comes when there is invalid syntax in web config file
Upvotes: 17
Reputation: 33
I had a similar error and it turned out I had to replace the spaces at the beginnings of lines with actual tabs. Don't know why, but that worked.
Upvotes: 0
Reputation: 11
Even I came across the same issue till I corrected some Semantic errors
Before:- " ( double quotes at the last)
After:- (double quotes at the last was removed)
After making the changes specflow worked fine for me.
Upvotes: 1
Reputation: 11
I've encountered this issue while copying the entire connection settings from Sticky Notes to the Machine.config file. I tried through the .config file, if there was any "S" characters available while saving the file. The real issue was as I stated above. Resolution:: Instead of copying the connection settings from Sticky Notes to the .config files, I've copied the settings to a "Notepad" and then copied to .config and IT WORKED !!!
Upvotes: 1
Reputation: 1033
Make sure there's no stray character in the configuration file. It can be as "harmless" as a misplaced "-->" or extra ." or anything really minor.
Upvotes: 34