0

I am having a problem on connecting my web application on the cloud server. My application works perfectly on the Test Server (On-Prem) using this connection string

<connectionStrings> <add name="CONNECTIONNAME" providerName="MSOLEDBSQL" connectionString="Data Source=IPADDRESS; Initial Catalog=DBNAME; UID=USERNAME; PWD=PASSWORD; Connection Timeout=100000; Trusted_Connection=True; MultipleActiveResultSets=True;" /> </connectionStrings>

But when I use this connection string and change the Data Source, Initial Catalog to the Cloud Server information, Remove the UID and PWD because it has no authorization, It returned Object Reference is not set meaning the connection I am linking is incorrect.

Am I doing something wrong or what? Can someone help me solve my problem.

I already tried setting the Data Source to localhost and there is no improvement. I put already the Trusted Connection because there is no USERNAME and PASSWORD on SQL Server, I am only using Windows Authentication.

Levesque Xylia
  • 349
  • 3
  • 16

1 Answers1

1

Can you try the below connection string,

<connectionStrings> 
 <add name="CONNECTIONNAME" 
   connectionString="data source=localhost;
   initial catalog=<DBNAME>;
   Integrated Security=SSPI;
   Connection Timeout=100000;
   Trusted_Connection=True;
   MultipleActiveResultSets=True;" 
   providerName="System.Data.SqlClient" /> 
</connectionStrings> 
Charles Han
  • 1,920
  • 2
  • 10
  • 19
  • What the. Thank you, Sir. That will do. So setting the Integrated Security Fix the problem, How is that? Tried removing it and it will not work. Can you explain more? Thanks again Sir. A lot. – Levesque Xylia Dec 21 '22 at 07:48
  • 1
    Setting the `Integrated Security` field to True or SSPI means you want to log in to the database via Windows Authentication. A bit more explanation from this post https://stackoverflow.com/questions/1229691/what-is-the-difference-between-integrated-security-true-and-integrated-securit – Charles Han Dec 21 '22 at 07:50