SQL Server – Resolving ‘Cannot Generate SSPI Context’ Error

connectivitysql serversql-server-2008-r2

When I try to connect to a SQL Server from my local machine I get the following error:

Cannot connect to Computer1\Instance1.
The target principal name is incorrect.
Cannot generate SSPI context.
(Microsoft SQL Server, Error: 0)

When I tried to connect to the same instance through RDP, it throws the following error:

TITLE: Microsoft SQL Server Management Studio
Error connecting to 'Computer1\Instance1'.
Attempted to divide by zero. (mscorlib)

At the same time it is connecting successfully through CMD. It was working fine, until last night. but now I am unable to connect to it.

Best Answer

This error occurred because the TCP port was wrongly configured for the instance.

Initially, I checked named pipes and shared memory; everything was perfect. Then I discovered that the TCP/IP protocol port was mismatched, by checking the port configuration in the IP Address tab.

I enabled port 1433 for the server's IP address and pressed OK. Now it works.