Base solution for your next web application
Open Closed

I want to set default connection string to target my company's SQL server database. #7377


User avatar
0
xitix created

In *appsettings.json ` "ConnectionStrings": {

//Below commented string is working perfectly, Pointing my local machine.
//"Default": "Server=DESKTOP-GMHSAJV; Database=PhoneBookDemoDb; Trusted_Connection=True;"

// after pointing to server(115.XXX.XX.X9), it is not working.**
"Default": "Server=115.XXX.XX.X9; Database=PhoneBookDemoDb;User ID=sa;Password=xxxxxxxxxx;Trusted_Connection=True;"

}`

when I pass update-database command in pakage manager console PM>update-database

Gives below error : Error Number:18452,State:1,Class:14 Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Can you please guid how to set server's database's connection string as default string.


3 Answer(s)
  • User Avatar
    1
    oaalvarado created

    Hi,

    Remove "Trusted_Connection=True;" from the connectionString, if you are not using Windows Authentication. Looks like you are using a SQL Server user to connect to the database.

  • User Avatar
    0
    musa.demir created

    can you connect that sql server with using ssms or one of visual studio sql server extension? That server may only accept Windows Authentication mode.

  • User Avatar
    0
    xitix created

    Hi Mr.Oaalvarado, I Removed "Trusted_Connection=True" and it is working, Thank you so much.

    **Hi Mr. demirmusa , ** Sir I connecting it to SSMS. thanks