在连接数据库时,提示System.TypeInitializationException

数据库的连接字符串放在config文件中,而config中有两个文件,起初放在debug.comfig中,启动调试时出现这个异常,放在release.config试了下,也不行。

解决的方法有两种:

第一:将连接字符串在代码中写死

第二:就是双击web.config文件,将连接字符写在里面

System.TypeInitializationException的更多相关文章

  1. System.TypeInitializationException: The type initializer for 'Mono.Unix.Native.Stdlib' threw an exception.

    08-31 17:02:03: ### DEBUG ##########################System.TypeInitializationException: The type ini ...

  2. System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> Oracle.DataAccess.Client.OracleException: 提供程序与此版本的 Oracle 客户机不兼容”

    .net应用程序通过Oracle.DataAccess.dll访问64位的Oracle服务器,在连接时出现以下异常:“System.TypeInitializationException: The t ...

  3. An unhandled exception of type 'System.TypeInitializationException' occurred in System.ServiceModel.dll

    异常“ An unhandled exception of type 'System.TypeInitializationException' occurred in System.ServiceMo ...

  4. System.TypeInitializationException: 'The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.'

    下午在调试的时候报错数据库连接就报错我就很纳闷后面用原来的代码写发现还是报错 System.TypeInitializationException: 'The type initializer for ...

  5. C#使用NLOG System.TypeInitializationException,类型初始值设定项引发异常

    C#如何使用NLOG,网上有很多介绍,本次使用时遇到一个问题,使用NLOG写日志时,出现初始化异常,基本异常信息如下: System.AggregateException: 发生一个或多个错误. -- ...

  6. 关于System.TypeInitializationException异常

    什么是System.TypeInitializationException 作为类初始值设定项引发的异常的包装器而引发的异常. 继承 Object Exception SystemException ...

  7. String.Net “System.TypeInitializationException”类型的未经处理的异常在 Spring.NetDemo.exe 中发生

    今天编写String.Net时,遇到“System.TypeInitializationException”类型的未经处理的异常在 Spring.NetDemo.exe 中发生 原因配置文件的顺序写错 ...

  8. .net System.TypeInitializationException 类型初始值设定项引发异常

    错误原因:静态字段连接数据库内容错误(应为Integrated Security=True) 果然解决! 来自:http://blog.csdn.net/zhang1597116/article/de ...

  9. System.Security.SecurityException The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception

    [15/08/19 00:03:10] [DataManager-7292-ERROR] System.Reflection.TargetInvocationException: Exception ...

随机推荐

  1. 如何尽量避免引用jQuery

    Introduction 正如jQuery所宣称的一样,Write Less, Do More.很多时候我们喜欢用它来解决问题.但增加一个库必然意味着更大的网络负担,意味着更高的页面初始载入时间.并且 ...

  2. Navicat for MySQL在ubuntu下运行没有反应

    Step1: 打开Navicat官网,下载Navicat ,网址:http://www.navicat.com/en/download/download.html Step2:进入下载目录,解压压缩包 ...

  3. Incredibuild导入key的方式

    作者:朱金灿 来源:http://blog.csdn.net/clever101 Incredibuild5.0采用新的授权机制,在安装完服务端之后右键单击它的授权文件License .ib_lic, ...

  4. error c2243:"类型转换" 转换存在,但无法访问

    今天在程序的中有一段class Quackable : QuackObservable,结果一直出现error c2243:"类型转换" 转换存在,但无法访问. 后来发现只要改成c ...

  5. Obj-C Memory Management

    Memory management is one of the most important process in any programming language. It is the proces ...

  6. 将Android系统源码导入Android studio的方法

    Android源码目录结构如下: |-- Makefile|-- abi (applicationbinary interface,应用程序二进制接口,生成libgabi++.so相关库文件)|-- ...

  7. uvm_marcos——UVM宏定义

    I programmed all night.Through the window, on my screen,The rising sun shined. 编程一整夜,透过窗户,照在屏幕上.初升的太 ...

  8. vs2010调试sql2008存储过程

      1.安装vs2010sp1补丁 2.vs中打开服务器资源管理器,并进行数据库连接,连接时要注意 3. 4.可以打开数据库中的存储过程进行调试了

  9. powershell 版本问题

    Login-AzureRmAccount : 无法将“Login-AzureRmAccount”项识别为 cmdlet.函数.脚本文件或可运行程序的名称.请检查名称的拼写,如果包括路径,请确保路径正确 ...

  10. remote: Incorrect username or password ( access token ) fatal: Authentication failed for

    gitee推送到远程仓库时提示错误remote: Incorrect username or password ( access token )fatal: Authentication failed ...