Below code is working fine when I am coding. I publish code in IIS and then connection is failing.
I know, When I am coding is taking my window login as credentials and In IIS it is taking AppPool Identity. How can I pass my windows login credentials to connectionstring?
Public Shared Function DbCollection(connectionString As String) As DatabaseCollection
Dim server As New Microsoft.SqlServer.Management.Smo.Server(connectionString)
Return server.Databases
End Function
Error:
Login failed for user 'Domain\Computername$'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'Domain\Computername$'.