我尝试创建数据库架构的副本,然后暂时在应用程序中将其用于测试目的,因此我不会更改实时数据。但是,无论我做什么,它总是给我这个错误:
An exception of type 'System.ArgumentException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
我试过让我的连接字符串如下所示:
<add name="EntitiesConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\vipertest.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="EntitiesConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\vipertest.mdf;Integrated Security=SSPI;User Instance=True" providerName="System.Data.SqlClient"/>
我已尝试使用mdf文件,但没有。
我已经在Web.Config和app.config中完成了这项工作,但我总是得到同样的错误。