An ASP.NET application on Windows hosting connects to its Microsoft SQL Server (MSSQL) database through a connection string. It holds four values: the database server, the database name, the database user and that user's password. This guide shows the correct syntax for modern .NET and for classic ASP.NET, where to find each value in Plesk, and how to fix the errors people hit most often.
Use Server=YOUR_DB_HOST;Database=YOUR_DB_NAME;User ID=YOUR_DB_USER;Password=YOUR_PASSWORD;TrustServerCertificate=True; and copy the host and names exactly as Plesk shows them under Databases. Put the string in appsettings.json for ASP.NET Core, or in the connectionStrings section of web.config for ASP.NET Framework, and never hard-code it in your pages. Connect from the application running on your hosting account; don't plan on connecting from your own PC.
1. The connection string, part by part
A SQL Server connection string is a list of key=value pairs separated by semicolons. Several keys have older synonyms, so you will see both forms in tutorials:
| Key | Older synonym | What to put there |
|---|---|---|
| Server | Data Source | The database host exactly as Plesk shows it, including any instance name after a backslash |
| Database | Initial Catalog | The full database name from Plesk |
| User ID | UID | The database user you created in Plesk (not your Plesk login) |
| Password | PWD | That database user's password |
| TrustServerCertificate | none | True if you get a certificate error (see section 5) |
A complete example, with the placeholders in capitals replaced by your own values:
Server=YOUR_DB_HOST;Database=example_db;User ID=example_user;Password=YourStrongPassword;TrustServerCertificate=True;Don't add Integrated Security=True or Trusted_Connection=True. Those use Windows authentication, and a hosting account signs in with a SQL Server user name and password instead.
2. Find the values in Plesk
- Log in to Pleskfor your Windows hosting account.
- Open Databasesfor your website. If you haven't created a database yet, click Add Database, choose the MSSQL server, and create a database user with a strong password at the same time.
- Click Connection Infoon the database. Plesk shows the database host, the database name and the user name to use.
- Copy the values exactly.Database names and user names are often longer than what you typed, because Plesk may add a prefix. The password is the one you set; if you've lost it, set a new one on the database user.
For a walkthrough of creating the database, see Creating and managing MSSQL databases in Plesk.
Tutorials use localhost, (local) or an instance name such as .\SQLEXPRESS. Any of those can be wrong for your account. The database host in Connection Info is the one that works, so copy it rather than guessing.
3. ASP.NET Core and modern .NET
Store the string in appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=YOUR_DB_HOST;Database=example_db;User ID=example_user;Password=YourStrongPassword;TrustServerCertificate=True;"
}
}Install the current SQL Server driver, Microsoft.Data.SqlClient (Entity Framework Core's SQL Server provider already includes it):
dotnet add package Microsoft.Data.SqlClientRead the string by its name. With Entity Framework Core, in Program.cs:
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));Or with plain ADO.NET:
using Microsoft.Data.SqlClient;
var connStr = builder.Configuration.GetConnectionString("DefaultConnection");
await using var conn = new SqlConnection(connStr);
await conn.OpenAsync();System.Data.SqlClient, the driver in older tutorials, is deprecated. Use Microsoft.Data.SqlClient for new code.
4. ASP.NET Framework (web.config)
For an ASP.NET Framework site (Web Forms or MVC 5), put the string inside configuration in web.config:
<connectionStrings>
<add name="DefaultConnection"
connectionString="Server=YOUR_DB_HOST;Database=example_db;User ID=example_user;Password=YourStrongPassword;"
providerName="System.Data.SqlClient" />
</connectionStrings>Then read it in code by the same name:
using System.Configuration;
string connStr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;The class is ConfigurationManager, not the long-obsolete ConfigurationSettings. The name in brackets must match the name attribute in web.config exactly; a mismatch gives a NullReferenceException when the page loads. Add a reference to System.Configuration if the compiler can't find ConfigurationManager.
Plesk lets you edit web.config in its File Manager, or you can publish it with Web Deploy along with the rest of your site.
5. Encryption and certificate errors
Since version 4.0, Microsoft.Data.SqlClient encrypts the connection by default and checks the server's certificate. If the certificate isn't trusted by the web server, the connection fails with:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)The usual fix is to add TrustServerCertificate=True; to the string. The connection stays encrypted; only the certificate check is skipped. For a database on the same hosting platform, this is the standard setting.
6. Connecting from your own computer
Plan for your application to reach the database from your hosting account, not from your PC. When we checked our Windows hosting server from outside on 23 September 2026, SQL Server's standard port was closed, so SQL Server Management Studio or Visual Studio on your computer can't be expected to connect.
Instead:
- manage tables and data from the database tools in Databases in Plesk;
- import and export with Plesk's Import Dump and Export Dump on the database;
- keep a separate local SQL Server (Express or Developer edition) for development, and use a different connection string on your PC.
Keep the two strings apart with appsettings.Development.json in .NET, or a web.config transform in ASP.NET Framework, so you never deploy your local string by mistake. If your project really needs remote access to the hosted database, ask support whether it can be arranged for your account.
7. Common errors and fixes
| Error message | Usual cause | Fix |
|---|---|---|
| Login failed for user '…' | Wrong user name or password, or the user isn't linked to this database | Copy the user from Connection Info; reset the database user's password in Plesk |
| Cannot open database "…" requested by the login | Database name is wrong or incomplete | Copy the full name, with any prefix, from Plesk |
| A network-related or instance-specific error occurred | Wrong server name or instance | Use the host exactly as Connection Info shows it |
| The certificate chain was issued by an authority that is not trusted | Encryption on, certificate not trusted | Add TrustServerCertificate=True; |
| Keyword not supported: '…' | A typo, or a key from another driver | Check each key name and its spelling |
Object reference not set to an instance of an object (on ConnectionStrings[...]) | Name in code doesn't match web.config | Make both names identical |
Keep the connection string in configuration, not in .cs or .aspx files, and keep configuration files with real passwords out of public Git repositories. If a password has been exposed, change it on the database user in Plesk and update the string.
If the error isn't in this table, read Troubleshooting common ASP.NET issues, or open a ticket with the full error text (without your password).
8. Windows hosting at Domain India
Domain India's Windows hosting runs ASP.NET on IIS, managed with Plesk, and includes MSSQL databases: 1 on ASP Starter and 5 on ASP Business. Windows hosting has no SSH; you work through Plesk, FTP and Web Deploy. Prices on the cards are Domain India list prices, excluding 18% GST.
- 10 GB Storage
- 50 GB Monthly Bandwidth
- 1 Website
- 10 Email Accounts
- 30 GB Storage
- 150 GB Monthly Bandwidth
- 5 Websites
- 50 Email Accounts
Stuck on a connection error? Our support team is on 24/7 live chat, and tickets get a first response within 15 minutes; resolution time depends on the issue. There is no phone support.
Frequently asked questions
What connection string do I use for MSSQL on Windows hosting?
Use Server=YOUR_DB_HOST;Database=YOUR_DB_NAME;User ID=YOUR_DB_USER;Password=YOUR_PASSWORD;TrustServerCertificate=True; and copy the host, database name and user name exactly as Plesk shows them in the database's Connection Info.
Where do I find the MSSQL server name in Plesk?
Open Databases in Plesk and click Connection Info on your database. It shows the database host, the full database name and the user name to use in your connection string.
Should I use Data Source or Server in the connection string?
Either works. Server and Data Source are synonyms, as are Database and Initial Catalog. Use one form consistently.
Why do I get "The certificate chain was issued by an authority that is not trusted"?
Microsoft.Data.SqlClient 4.0 and later encrypt connections and check the server certificate by default. Add TrustServerCertificate=True; to the connection string; the connection stays encrypted.
Can I connect to my hosted MSSQL database from SQL Server Management Studio on my PC?
Plan on connecting from your application on the hosting account instead. SQL Server's standard port was closed from outside when we checked our Windows hosting server in September 2026. Use Plesk's database tools, or ask support if your project needs remote access.
Where do I put the connection string in an ASP.NET Core app?
In appsettings.json under ConnectionStrings, and read it with builder.Configuration.GetConnectionString("Name") or pass it to Entity Framework Core's UseSqlServer.
Should I use System.Data.SqlClient or Microsoft.Data.SqlClient?
Use Microsoft.Data.SqlClient for new code. System.Data.SqlClient is deprecated; you will still see it as the providerName in older web.config files.
Ready to run your ASP.NET application? Compare Windows hosting plans, read Creating and managing MSSQL databases in Plesk, or ask us in a support ticket.
Plesk, IIS and MSSQL databases included, with free SSL on every plan.
See Windows hosting plans