开发者

"Unrecognized configuration section connectionStrings" in app.exe.config

开发者 https://www.devze.com 2022-12-23 12:05 出处:网络
On a Terminal Server install of my .NET 2.0 WinForms app, one of my clients gets the following exception on startup:

On a Terminal Server install of my .NET 2.0 WinForms app, one of my clients gets the following exception on startup: "Unrecognized configuration section connectionStrings" This is occurring in myapp.exe.config but I can't figure out why. Runs perfectly everywhere else, only difference between this install and any other is the connection string.

I've searched around, but can only find this issue relating to ASP.NET apps and issues in web.config. Any ideas what could be broken in the config of this WinForms app though? Is it indicating a problem further up in machine.conf开发者_如何学编程ig?

FYI the top part of myapp.exe.config is:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
  <section name="MyApp.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
  <section name="MyApp.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
    <add name="MyApp.DataAccessLayer.Settings.MyConnectionString" connectionString="$$$$$$" providerName="System.Data.SqlClient" />
</connectionStrings>
...

thanks

Richard


Add this inside configSections tag:

<section name="connectionStrings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=jjjjjjjj" requirePermission="false" />


The above answer worked although the actual cause of the issue was a (somehow!) broken .NET Framework installation. Reinstalling/repairing the .NET install resolved the issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号