Exception: type initializer for 'system.data.sqlclient.sqlconnection'?

后端 未结 12 890
悲哀的现实
悲哀的现实 2020-12-11 02:35

I couldn\'t figure out what is the problem for this exception.

The type initializer for \'System.Data.SqlClient.SqlConnection\' threw an exception

12条回答
  •  执笔经年
    2020-12-11 02:46

    I also faced that exception once when I reopened my project. In my case the Config file had empty tag and key as you can see below. I removed the appSettings tag to fix the problem.

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

    < configuration>

    < appSettings>

    < add key="" value="site"/>

    < /appSettings>

    < configSections>

    < /configSections>

    < /configuration>

提交回复
热议问题