1
votes

I have created a webpart which works fantastic on my Virtual Machine where I have developed it.

But When I try to run the same webpart on my physical Machine, I cannot open the SQL Connection as the SQL Server is Seperate box on the network.

My Physical, Virtual and SQL Box are on the Same network but for some reason, It doesn't work on my Physical Machine,

It Come up with the following Message: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

What causes this Issue?

2
If you have sql installed on your physical machine, try to connect to the database located on Virtual Machine.ashish.chotalia
con.ConnectionString = "Server=" + _ipAddress + "; Database=" + _Database + "; Persist Security Info=True; User Id=username ;Password= password; Trusted_Connection=True";Hari Gillala
That works Marek. Thanks a lot.Hari Gillala

2 Answers

2
votes

You are using Intgrated Security, which means the current User is used for authentication against the database service. On the production server the webpart code is executed, using the anonymous user. And (of course) this user has no right to access any ressources other the web server files.

To avoid this behaviour use a dedicated account using SQL-Server security. See this example Connection string:

connectionString="Data Source=SERVERHOSTNAME;Initial Catalog=YOURDATABASE;Persist Security Info=True;User ID=YOURUSER;Password=YOURPASSWORD";

Be sure to get a valid logon from your production database administrator for your database with appropriate rights (such as db_reader).

1
votes

You specified User Id and Password and then set Trusted_Connection to True, so I guess that integrated authentication is used - remove the Trusted_Connection=True part.