Here is my connection string:
Server=sql145.main-hosting.eu:3306;Database=u230450666_aspt;User=u230450666_aspt;Password=111111;
That I use like this:
services.AddDbContext<UsersContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DatabaseUrl")));
And I can't connect to my database, I got this error:
System.Data.SqlClient.SqlException (0x80131904): 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: 25 - Connection string is not valid)
System.ComponentModel.Win32Exception (0x80004005): The parameter is incorrect
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
Thus I tried with HeidiSQL, as follows:
and it worked.
So I must miss some settings with UseSqlServer
..
(I'm following this tutorial)