{"action":"created","issue":{"url":"https://api.github.com/repos/MEyes/ASP.NET-Identity-User-Management/issues/2","repository_url":"https://api.github.com/repos/MEyes/ASP.NET-Identity-User-Management","labels_url":"https://api.github.com/repos/MEyes/ASP.NET-Identity-User-Management/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/MEyes/ASP.NET-Identity-User-Management/issues/2/comments","events_url":"https://api.github.com/repos/MEyes/ASP.NET-Identity-User-Management/issues/2/events","html_url":"https://github.com/MEyes/ASP.NET-Identity-User-Management/issues/2","id":166273871,"number":2,"title":"数据库链接失败。","user":{"login":"aehyok","id":5900140,"avatar_url":"https://avatars.githubusercontent.com/u/5900140?v=3","gravatar_id":"","url":"https://api.github.com/users/aehyok","html_url":"https://github.com/aehyok","followers_url":"https://api.github.com/users/aehyok/followers","following_url":"https://api.github.com/users/aehyok/following{/other_user}","gists_url":"https://api.github.com/users/aehyok/gists{/gist_id}","starred_url":"https://api.github.com/users/aehyok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aehyok/subscriptions","organizations_url":"https://api.github.com/users/aehyok/orgs","repos_url":"https://api.github.com/users/aehyok/repos","events_url":"https://api.github.com/users/aehyok/events{/privacy}","received_events_url":"https://api.github.com/users/aehyok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-19T08:21:18Z","updated_at":"2016-07-21T10:30:06Z","closed_at":null,"body":"数据库链接字符串是没问题的，因为其他项目都是可以的。还望指教一下，试了好几天了，没搞明白，先谢谢大神了。\r\n\r\n\r\n无法打开登录所请求的数据库 \"IdentityDb\"。登录失败。\r\n用户 'sa' 登录失败。\r\n\r\n说明: 执行当前 Web 请求期间，出现未经处理的异常。请检查堆栈跟踪信息，以了解有关该错误以及代码中导致错误的出处的详细信息。 \r\n\r\n异常详细信息: System.Data.SqlClient.SqlException: 无法打开登录所请求的数据库 \"IdentityDb\"。登录失败。\r\n用户 'sa' 登录失败。\r\n\r\n源错误: \r\n\r\n\r\n行 35:             if (ModelState.IsValid)\r\n行 36:             {\r\n行 37:                 AppUser user = await UserManager.FindAsync(model.Name, model.Password);\r\n行 38:                 if (user==null)\r\n行 39:                 {\r\n\r\n源文件: f:\\aehyok\\Asp.Net Identity\\ASP.NET-Identity-User-Management-master\\ASP.NET-Identity-User-Management-master\\Users\\Controllers\\AccountController.cs    行: 37 \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/MEyes/ASP.NET-Identity-User-Management/issues/comments/234216534","html_url":"https://github.com/MEyes/ASP.NET-Identity-User-Management/issues/2#issuecomment-234216534","issue_url":"https://api.github.com/repos/MEyes/ASP.NET-Identity-User-Management/issues/2","id":234216534,"user":{"login":"MEyes","id":2033880,"avatar_url":"https://avatars.githubusercontent.com/u/2033880?v=3","gravatar_id":"","url":"https://api.github.com/users/MEyes","html_url":"https://github.com/MEyes","followers_url":"https://api.github.com/users/MEyes/followers","following_url":"https://api.github.com/users/MEyes/following{/other_user}","gists_url":"https://api.github.com/users/MEyes/gists{/gist_id}","starred_url":"https://api.github.com/users/MEyes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MEyes/subscriptions","organizations_url":"https://api.github.com/users/MEyes/orgs","repos_url":"https://api.github.com/users/MEyes/repos","events_url":"https://api.github.com/users/MEyes/events{/privacy}","received_events_url":"https://api.github.com/users/MEyes/received_events","type":"User","site_admin":false},"created_at":"2016-07-21T10:30:06Z","updated_at":"2016-07-21T10:30:06Z","body":"解决了吗，看异常应该是连接字符串的问题，\r\n1.我看了一下连接字符串，使用了默认的LocalDb， (localdb)\\v11.0 这是VS 2013写法。\r\nVS 2015 写法 (Localdb)\\MSSqllocaldb。\r\n2.上面没问题的话，那就是Code First 迁移策略的问题，我指定的是NULL 策略，他不会自动产生数据库，因为事先可能存在了。\r\n简单做 把这这句话 注释掉 Database.SetInitializer<AppIdentityDbContext>(new IdentityDbInit());\r\n默认策略是CreateDatabaseIfNotExist，不存在数据库则创建。\r\n\r\n"}}
{"actor":{"display_login":"MEyes"}}