You get "Cannot connect to Configuration database" while accessing Central Administration or any SharePoint sites.
In Event Viewer we get the below error on the SharePoint server.
Event Type: ErrorEvent Source: Windows SharePoint Services 3Event Category:
Database Event ID: 5586
Time: 12:36:31 AM
Description:Unknown SQL Exception 0 occured. Additional error information from SQL Server is included below. Cannot generate SSPI context.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
While trying to connect using connect.udl file, it gives the same error "Cannot generate SSPI Context"
On the SQL 2005 Server we get the below error.
Event Type: Error
Event Source: MSSQLSERVER
Event Category: (4)
Event ID: 17836
Time: 11:51:45 PM
Length specified in network packet payload did not match number of bytes read; the connection has been closed. Please contact the vendor of the client library. [CLIENT:IP of SP Server]
Quick Resolution:- Reboot the SQL Server 2005
How to troubleshoot the "Cannot generate SSPI context" error message
This is related to some SPN configurations gone incorrect on the SQL server.
Logon to the server using Domain Admin rights.
Download Setspn.exe from Microsoft site to set the SPN's for the SQL server.
At command prompt go to the location where setspn.exe was installed.
C:\Program files\support tools>setspn -L MyDomain\MyUserName
Registered ServicePrincipleNames for CN=MyUserName Service Account, OU=Service Accounts, DC=MyDomain,DC=com: mssqlsvc/MyServer1.MyDomain.com:MyPort mssqlsvc/MyServer2.MyDomain.com:MyPort mssqlsvc/MyServer3.MyDomain.com:MyPort
If you are getting the error (Cannot generate SSPI context), you will not find the SQL server name in the list displayed by the command.
To Register your SQL server type the following command.
setspn -A MSSQLSvc/MyServer.MyDomain.com:1433 MyAccount
Note:- MyServer will be the SQL server name to which you are not able to connect.
Again run the setspn -L MyDomain\MyUserName command, you should find your SQL servers FQDN registered.