sql-serverionos

Error connecting to shared server SQL database (IONOS)


I am trying to use IONOS shared hosting to host my site. Originally I was getting an HTTP 500 error when running my app. I put a try/catch around the first database call in my site, and displayed the error using return Content($"Database error:{ex.Message}" );

This produces the exception below. I have tried everything I can think of to make this connection work. I am curious about the provider being used and the proper way to identify it in the appsettings.json file. My current settings are included in the code block. IONOS support says they can't help and suggested that I post to the community for help.

I have successfully created a database on their site and have restored my local copy to it. I use their tool to verify that the tables and stored procedures are indeed in my database on their site.

Exception:

Database error: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: SNI_PN11, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)

appsettings.json:

    {
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "IONOS": "Server=db953512847.hosting-data.io;Initial Catalog=dbxxxxxxxxx;Database=dbxxxxxxx;User ID=dboxxxxxxx;Password=xxxxxxxxxx;MultipleActiveResultSets=True;Persist Security Info=false",
    "ProviderName": "System.Data.SqlServer"
  }
}

Solution

  • I eventually got this to work. It was credentials issue. I put try/catch around first database access and was able to see the error and make progress.