Cannot create SSPI context

前端 未结 19 1354
北海茫月
北海茫月 2020-12-28 13:13

I am working on a .NET application where I am trying to build the database scripts. While building the project, I am getting an error \"Cannot create SSPI context.\". This e

相关标签:
19条回答
  • 2020-12-28 13:52

    It sounds like your PC hasn't contacted an authenticating domain controller for a little while. (I used to have this happen on my laptop a few times.)

    It can also happen if your password expires.

    0 讨论(0)
  • 2020-12-28 13:52

    In my case it was a missing SPN, had to run these two commands:

    setspn -a MSSQLSvc:SERVERNAME SERVERNAME setspn -a MSSQLSvc:SERVERNAME:1433 SERVERNAME

    In other words in my case I had the FQDN in there already correctly but not just the NETBIOS name, after adding these it worked fine. Well initially it didn't but after waiting 2 minutes it did.

    0 讨论(0)
  • 2020-12-28 13:53

    We had this issue on instances in which we changed the service user from Domain1\ServiceUser to Domain2\ServiceUser. The SPNs remained registered under Domain1\ServiceUser, and never registered under Domain2\ServiceUser. We registered the SPNs under Domain2\ServiceUser, but the issue persisted. We then removed the SPNs under Domain1\ServiceUser, and the issue was resolved.

    0 讨论(0)
  • 2020-12-28 13:54

    In vb.net, if you are using a linked server than check your connection string. Integrated Security=true; doesn't work in all SQL providers, it throws an exception when used with the OleDb provider. So basically Integrated Security=SSPI; is preferred since works with both SQLClient & OleDB provide. If you still hit with error, remove the syntax completely.

    0 讨论(0)
  • 2020-12-28 13:55

    Here is my case. I had a remote machine that hosted SQL Server. From my local machine, I was trying to access the SQL instance via some C# code and I was getting this error. My password for the user account on my machine/domain had expired. I fixed it with the following:

    1. Opened the remote machine, which prompted me for a password change
    2. I changed my password within this prompt and logged into the remote machine
    3. I "locked" my local machine (using windows + L key so I didn't have to completely sign off) so that I could get back to the sign-on page
    4. I signed back onto my local machine with the new password

    Everything then worked fine.

    0 讨论(0)
  • 2020-12-28 13:56

    It's quite a common error with a variety of causes: start here with KB 811889

    • What version of SQL Server?
    • And Windows on client and server?
    • Local or network SQL instance?
    • Domain or workgroup? Provider?
    • Changing password
    • Local windows log errors?
    • Any other apps affected?
    0 讨论(0)
提交回复
热议问题