2017-03-27 50 views
1

我试图将ASP.NET身份添加到我的Web API 2项目。 REST服务工作正常,但每当我尝试注册(在http://localhost:3216/Account/Register)发生这种情况:ASP.NET身份不适用于web api 2

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)

有它发生:

var result = await UserManager.CreateAsync(user, model.Password); 

如果您需要有关代码的进一步信息随时问,但在那一刻我不知道代码片段可以帮助你。

此致敬礼!

+0

您是否已经打开Web服务器和数据库服务器之间的防火墙端口? – criticalfix

回答

1

您是否参考过您使用的上下文服务?

在Microsoft示例中,他们创建了另一个用于测试目的。只要使用相同的上下文作为您的休息服务,我应该工作得很好。

+0

为我工作!感谢我对此有点困惑......我是新来的asp.net :) –