1

I am developing a web application with asp.net core 2.2 and angular 7. My application is working locally but when I upload the application and SQL Server database to "1&1 Ionos" hosting server, it can't connect to the database there.

I tried with the connection string they provided in their database admin panel but it just not working.

Here is the appsettings I used in my application.

{
  "AppSettings": {
    "Secret": "bla bla bla"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "CustomPosConnection": "Provider=sqloledb;Data Source=db784146660.hosting-data.io,1433;Initial Catalog=myDbName;User Id=myUserId;Password=myPass;"
  }
}

Here "myDb" ,"myUserId","myPass" is equivalent to actual database name ,actual user id they provided and actual password that i set when creating database in the hosting server.

Please help me to connect the database in 1&1 ionos hosting server by suggesting write connection string or guiding me what else I need to do or please share if anyone has example connection string for connecting to SQL Server database from asp.net mvc or asp.net web api or asp.net core application hosted in 1&1 Ionos windows server.

3
  • 1
    you should write your servername or IP address for Data Source value, you dont need write sql port in connectionstring. This is an example: "Data Source=192.168.5.17;Initial Catalog=DatabaseName;Integrated Security=false;UId=sa;pwd=123456;MultipleActiveResultSets=True" Commented May 13, 2019 at 5:06
  • 1
    Why don't you try asking their support rather? Commented May 13, 2019 at 5:19
  • Do not use Integrated Security = false. It probably won't work. Use Integrated Security = true and eliminate the user name and password. The SQL Server defaults to using Windows credentials (true) which uses the users windows account. Normally I create a Windows Group Account and set the database to use the group account. Then add uses to Group so multiple uses have access to the database. In a corporate network that uses Group Policy the group accounts already exist. Commented May 13, 2019 at 5:48

2 Answers 2

1

At last it worked,here is my working appsettings. Hopefully it will help you guys.

  "AppSettings": {
    "Secret": "bla bla bla"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "CustomPosConnection": "Data Source=db784146660.hosting-data.io,1433;Initial Catalog=myDb;Integrated Security=False;User Id=myUserId;Password=myPass;MultipleActiveResultSets=True;"
  }
}

Here "myDb" ,"myUserId","myPass" is equivalent to actual database name ,actual user id they provided and actual password that i set when creating database in the hosting server.

Sign up to request clarification or add additional context in comments.

3 Comments

It won't help because it's not clear how this differs from the question's connection string. You don't need to add Integrated Security=False;, that's false by default. The only real difference seems to be MARS=True, but even that won't prevent you from connecting. 1433 is the default port so there's no need to specify it either
it just worked for me that's why i thought to share it.
What worked? The only meaningful change seems to be removing the meaningless Provider=sqloledb;. This would be needed if you used OledbConnection but not SqlConnection.
0

It has been hard to figure out the connection string for .Net core shared hosting. My provider AspHostPortal worded with

"DefaultConnection": "Server=ipAddress\\SQL2017,782; Database=DatabaseFileName_without.mdf;Integrated Security=False; User Id=userName;Pwd=passWord;MultipleActiveResultSets=true"

Integrated Security=True may not work if SSL is not enabled on server

I am not sure why Microsoft change the format from Web.Config format to confuse everybody.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.