Application not able to access SQL Server 2005 using Trusted Connection

  • I am having a strange problem. I have an application that to connects to SQL Database in SQL Server 2005. When I run the application with Visual Studio everything works fine but when I deploy the application on my web server and then to access the site . I get an error :

    Login failed for user ''. The user is not associated with a trusted SQL Server connection.

    For some reason the application is not passing the user name .

    My connection string is correct as well

    <

    add name="xxxxx" connectionString="Data Source=xxxxxx;Initial Catalog=xxxx;Integrated Security=SSPI" providerName="System.Data.SqlClient"/>

     

    I will appreciate any kind of assistance in this matter.

     

    Thanks

     

  • try to use sql authentication.

    the problem you are getting is most likely due to the network configurations on your machine.if you try to access a folder on your sql box from your web server what error do you get. and have you tried to connect using sql tools


    Everything you can imagine is real.

  • I tried that as well.

     I can successfully connect to the sql box using sql tools and also able to access the folder. The only thing is that when I tried to access the application the login credentials don't go through at all and it throws an error.

     

  • are you saying you managed to successfully use SQL Authentication?

    Is the SQL user that is logged have access to the sql server?


    Everything you can imagine is real.

  • That might be "the three hops" problem - Windows can pass credentials from one machine to another, but the 2nd machine cannot turn around & pass those credentials to the 3rd machine. Hence, you can't make three hops.

  • yes,  I can map to any folder on the sql server from another server. I can run SQL Management Studio using SQL Authentication from my web server.

    What I am noticing is when I run the application. The error says "Login failed for user '' "

    Notice user is blank. For some reason I think it is not passing the user credentials.

    Any suggestions?

  • try this in your connection string

    connectionString="server=XXXXX;Initial Catalog=DBName;UID=XXXXX;PWD=XXXXXX"

    if you are using windows authentication, ensure that the user that runs the IIS process has access to the sql server,


    Everything you can imagine is real.

  • The error means Asp.net is not a user in your SQL Server and the database used to run the application, in Win2003 you can add the Network Service account to SQL Server and the database.  I noticed recently that Reporting Services drops the SQL login info several times in the dataset I created, and I don't know why so I just open the datasets properties and add the info again.  Hope this helps.

     

     

    Kind regards,
    Gift Peddie

  • I added Network Service account to SQL Server. Still no result.

     

    Any other suggestions..

     

    Thanks.

     

     

  • Ok.. here is something interesting.

    I check my sql logs and when I tried to make a connection using : UID and PWD in my connection string. The log says that

    Login failed for user "<username"> [CLIENT:xxx.xxx.xxx.xxx]

    below that I saw the the same user successfully logged using Management Studio saying

    Login succeeded for user "<username>" [CLIENT:local machine]

    I don't understand the difference. It is the same user connecting from the same local machine where sql is loaded.

    Thanks

     

     

     

  • in IIS use basic authentication

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply