Cannot Generate SSPI Context?!?!

One issue that just randomly cropped up on my Windows development machine was that I could no longer connect to some Sql Servers via Sql Server Management Studio. The error I got was “Cannot Generate SSPI Context”. I did a bunch of research on this and found that this typically has to do with TCP/IP and Kerberos authentication issues. I followed the advice in many of the articles that I found, but nothing worked.

There were a few posts indicating that this could have to do with poisoned DNS records. I pinged the name of the Sql Server and then looked up the name of the resulting IP – everything matched. On a whim, I put an entry in my hosts file for the IP address returned from the ping. Believe it or not, that fixed the problem.

Specifically, check out the file in %windir%\system32\drivers\etc named hosts. Edit it with notepad – there should be instructions in there on how to make the change. If %windir% doesn’t work for you, that’s just an environment variable pointing to the directory where Windows is installed, which is usually c:\windows (or c:\winnt for very old versions).

I have no idea why this worked or how it worked. Normally I’m not a fan of manual host entries for things that should resolve properly through DNS (or solutions that I don’t fully understand), but in this case it solved my problems. Hopefully this will help some of you out as well.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>