这是由于字符串不一致,从而导致无法连接数据库导致的。 解决方法:使model层app.config中的connectionstring与ui层中的web.config中connectionstring保持一致。