wpf “System.Windows.Navigation.BaseUriHelper”的类型初始值设定项引发异常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18075478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 09:22:32  来源:igfitidea点击:

The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception

c#wpfapp-config

提问by ControlPoly

in VS2012, WPF project, after add connection string , got error

在 VS2012,WPF 项目中,添加连接字符串后,出现错误

The type initializer for 'System.Windows.Application' threw an exception

“System.Windows.Application”的类型初始值设定项引发异常

The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception

“System.Windows.Navigation.BaseUriHelper”的类型初始值设定项引发异常

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <connectionstrings>
      <add connectionstring="Data Source=x.x.x.x; User Id=sa;Password=abc; Initial Catalog=hello;" name="ConString"/>
    </connectionstrings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

回答by Frode

connectionString with a capital S

大写S 的connectionString

The same with <connectionStrings>. Capital S

与 相同<connectionStrings>。资本小号

XML is case-sensitive.

XML 区分大小写。