System.Data.SqlClient.SqlException: Login failed for user

前端 未结 10 2338
难免孤独
难免孤独 2020-12-01 14:11

Working with my project in debug I have no issues. However running it in IIS I am getting this error:

System.Data.SqlClient.SqlException: Login failed for us

相关标签:
10条回答
  • 2020-12-01 14:41

    add persist security info=True; in connection string.

    0 讨论(0)
  • 2020-12-01 14:43

    kinda dumb, but I had a weird character (é) in my password. After omitting it, I no longer got the error.

    0 讨论(0)
  • 2020-12-01 14:43

    I tried some of the suggested answers but it didn't resolve the issue. Finally I found out that the default connection timeout (not command timeout) is 15 seconds and once I increased it to 60 it almost never happened again. simply add this to you connection string: ;Connection Timeout=60 I chose 60 seconds but you can put any value you think would fit the best to your needs.

    0 讨论(0)
  • 2020-12-01 14:44

    Numpty here used SQL authentication

    instead of Windows (correct)

    when adding the login to SQL Server, which also gives you this error if you are using Windows auth.

    0 讨论(0)
提交回复
热议问题