내 ASP.NET 프로젝트에서 사용자의 현재 역할을 ID로 가져 오려고합니다. 다음은 컨트롤러에 대한 내 코드는 다음과 같습니다ASP.NET MVC 특정 사용자를위한 역할 얻기
public ActionResult ChangeRole(string id)
{
var user = _context.Users.Single(u => u.Id == id);
var roles = new RoleManagerViewModel()
{
RoleNames = Roles.GetRolesForUser(user.Id)
};
return View(roles);
}
내가 그것을 실행하려고하면 내가 얻을 그러나이 오류 :
는 내가 의해The Role Manager feature has not been enabled.
roleManager enabled="true"
을 추가하는 것으로 해결할 수 있음을 읽어 보시기 바랍니다.
내가 추가 한 나의 web.config
파일로,이 오류가 발생하더라도 :
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
은 그냥 내 컴퓨터에 로컬 데이터베이스를 액세스하고, 그래서 내가 노력하고 내가 오류를 얻고 역할을 얻을 때 왜 내가 혼란 스러워요 생각합니다. – ecain
데이터 소스에 db local을 사용해 보셨습니까? – JDavila