Entity Framework 4.3.1 failing to create (/open) a database [Threading Anomaly?]

扶醉桌前 提交于 2019-12-05 05:12:57

You can see this exception when debugging if you happen to have "break when exception is thrown" option (Debug->Excptions) turned on. EF is trying to connect to the database but it fails since database does not exist yet so an exception is thrown. You see the exception due to the option above turned on. This exception is actually caught by the Entity Framework and EF will then connect to master database to create the database it was trying to connect in the first step. Once the database is created it will again use the original connection string to talk to the database. So, you can either press F5 to continue debugging since the exception is a first chance exception that will be handled or disable turn off "breaking when exception is thrown" which will result in breaking only for exceptions that are not handled rather than all exception that are thrown.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!