MSSQL Error 'The underlying provider failed on Open'

前端 未结 30 2545
时光取名叫无心
时光取名叫无心 2020-11-22 09:51

I was using an .mdf for connecting to a database and entityClient. Now I want to change the connection string so that there will be no

30条回答
  •  伪装坚强ぢ
    2020-11-22 10:37

    In my case I had a mismatch between the connection string name I was registering in the context's constructor vs the name in my web.config. Simple mistake caused by copy and paste :D

        public DataContext()
            : base(nameOrConnectionString: "ConnStringName")
        {
            Database.SetInitializer(null);
        }
    

提交回复
热议问题