1

I am running the code locally, and I have a database setup on a 3-rd party SQL Server and it has 5 tables for UserProfiles/Roles/Membership. I am trying to simply add a user to a role.

Below is my code for that simple exchange:

namespace InSight.Controllers
{
public class AdminController : Controller
{
//
// GET: /Admin/
public ActionResult Index()
{
Roles.AddUserToRole("schumacherj","Administrator");
return View();
}

}
}

The error that I receive when trying to access the Administrator controller with the offending code:

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)

Description: An unhandled exception occurred during the execution of the current web >request. Please review the stack trace for more information about the error and where it >originated in the code.

SQLExpress database file auto-creation error:

The connection string specifies a local Sql Server Express instance using a database >location within the application's App_Data directory. The provider attempted to >automatically create the application services database because the provider determined >that the database does not exist. The following configuration requirements are necessary >to successfully check for existence of the application services database and automatically >create the application services database:

EDIT:

So.... I asked much too soon.

I followed the advice in this answer: Godaddy ASP.NET membership database woes

Then I made a mistake and followed this one's advice: http://forums.asp.net/t/982572.aspx

I hope this helps someone besides me.

4

0 回答 0