Author Topic: Configuration system failed to initialize  (Read 270 times)

JTaylor

  • Pundit
  • *****
  • Posts: 1319
    • Data & Stuff Inc.
Configuration system failed to initialize
« on: April 29, 2020, 08:51:06 am »
Ran into a new one.  I *think* I have used CLR stuff with webbatch before without an issue so assuming this is a bit more specific to HtmlAgilityPack.   The error appears to be related to innerText, which makes me think it is related to the use of HttpUtility.HtmlDecode() under System.Web.   My understanding such errors are related to the app.config file.   Have done a lot of reading but still not clear what is needed in the config file.   Assuming that is the issue.     I have listed one of my  MANY attempts with the config file.    Suggestions?

Jim

Error#:          1261
Line:            If cNode > 0 Then title = StrTrim(cNode.InnerText)
Error Text:      COM/CLR: Exception
Additional Info: COM/CLR Exception:

    System.Configuration
    Configuration system failed to initialize


<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>

  <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >

    <section name="HtmlAgilityPack.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                     requirePermission="false" />

  </sectionGroup>

 
 
</configSections>
<startup>

  <supportedRuntime version="v4.0" sku=".NETFramework,Version=4.6"/>
</startup>
  <system.web>
    <httpRuntime targetFramework="4.6"/>
  </system.web>
<system.data>
 

</system.data>
</configuration>

td

  • Tech Support
  • *****
  • Posts: 3352
    • WinBatch
Re: Configuration system failed to initialize
« Reply #1 on: April 29, 2020, 10:04:58 am »
I am completely out of my depth when it comes to configuration files so I will offer a few random thoughts that are likely completely useless.

  • Don't know which web server software you are using.  But if it is IIS, IIS has some very quirky rules about file access.  I have been caught more than once by the server's internet user restrictions that allow WebBatch access to one file in a directory but not another when both files have the same permissions.  The only differences appear to be the file's extension and the API used to access them.
  • If you have access to the source code to your assembly, perhaps check the source code for which configuration settings the assembly is looking for.
  • Is the location of your config file correct?
  • Is the name of your config file correct?
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

  • Pundit
  • *****
  • Posts: 1319
    • Data & Stuff Inc.
Re: Configuration system failed to initialize
« Reply #2 on: April 29, 2020, 10:41:51 am »
Thanks.  Will give that some attention.  It is IIS.   I let VS do the naming so assume it is correct but will do some more reading to see what the rules are for naming.   I always see app.config or web.config in the reading but VS named it something different.   I went with app.config approach since it was webbatch using it but, again, wasn't certain or if it really matters.

Got to go see a man about some dirt and then back to the next round of head-bashing.   Thanks again.

Jim

td

  • Tech Support
  • *****
  • Posts: 3352
    • WinBatch
Re: Configuration system failed to initialize
« Reply #3 on: April 30, 2020, 02:11:38 pm »
I am sure you already thought of the possibility but I will mention it anyway. Does the machine running your Web server have the .Net framework version specified in your config file available?
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

  • Pundit
  • *****
  • Posts: 1319
    • Data & Stuff Inc.
Re: Configuration system failed to initialize
« Reply #4 on: April 30, 2020, 04:20:54 pm »
Yes.   That one did cross my mind.   I decided to remove the reference to System.Web from the project since I was only using it once and since nothing I tried seemed to work.  Even the stuff from M.S..  I assume I can call it from within the webbatch script.  Haven't gotten that far.

Thanks again.

Jim

td

  • Tech Support
  • *****
  • Posts: 3352
    • WinBatch
Re: Configuration system failed to initialize
« Reply #5 on: May 01, 2020, 09:00:12 am »
If you don't mind sharing, it will be interesting to hear how you resolve the problem.  And I need to set aside some time to brush up on the perils of dotNet assembly config file usage. Enquiring minds want to know... 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

  • Pundit
  • *****
  • Posts: 1319
    • Data & Stuff Inc.
Re: Configuration system failed to initialize
« Reply #6 on: May 01, 2020, 09:19:52 am »
Will do.   

Jim