Tuesday, 31 May 2011

SQL Server Cannot generate SSPI context

I was setting up SQL Server 2008 R2 on a brand new server (Windows Server 2008 R2) just as usual at work. After everything has been installed and configured as per previous installs on other servers, I get this "Cannot generate SSPI context" error when I tried to connect to SQL Server remotely from my desktop!

I have never encountered this error before, so I tried to look up the solution online. Apparently, this is a very tricky error, because there are many possible cases that could have caused SSPI context error!

There are a few work arounds that I found can get away with the error:
  1. Use SQL Server authentication instead of Windows Authentication
  2. Use Named Pipe instead of TCP/IP (set via SQL Server config manager)
  3. Let SQL Server service run as local built in account instead of domain user
The above methods make the error go away, but it didnt really solve the fundamental issue.

So, I looked further for the absolute cure to this problem, and finally, I found that the SPN (Server Principle Name) setting was not set properly for the domain user running SQL Server service. All I need to do is manually set the SPN (follow instructions here) and the problem is solved!!!


Note that this is not the only solution to the error, but thought it might be helpful to note it down in case same thing happens again in the future, it was pretty frustrating to find a solution to this problem...

For more detailed explanation to the error, please have a look at this Microsoft kb

No comments:

Post a Comment