locked
Blockuser result in: SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. RRS feed

  • Question

  • User-870004586 posted

    Hi,

    I have the following code to block a user:

     [HttpGet, ActionName("BlockUser")]
            [Authorize(Roles = "Admin")]
            public ActionResult BlockUser(string id)
            {
    
                MembershipUser user = Membership.GetUser(id);
                user.IsApproved = false;
                Membership.UpdateUser(user);
    
                return View("URL/Index");
    
            }

    But when push the button to block a user i get the following error:

    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)
    

    And yes 
    My connection string is right

    TCP is enabled on the right port 
    Firewall  is set up right
    And my SQL server allows remote connections.

    Can anyone help me with this problem?



    Tuesday, January 28, 2020 4:23 PM

All replies