SharePoint 2013 Hosting :: How to solve cannot generate SSPI context in SharePoint

You get “Cannot connect to Configuration database” while accessing Central Administration or any SharePoint sites.

banner-ahp

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
Date: 7/13/2009
Time: 12:36:31 AM
User: N/A
Computer: COMPUTERNAME
Description: Unknown SQL Exception 0 occured. Additional error information from SQL Server is included below. Cannot generate SSPI context.

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
Date: 6/25/2009
Time: 11:51:45 PM
User: N/A
Computer: COMPUTERNAME
Description:
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

Error Troubleshooting: – How to troubleshoot the “Cannot generate SSPI context” error message

This is related to some SPN configurations gone incorrect on the SQL server.

Resolution:
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:MyPortmssqlsvc/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.

Best SharePoint Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers SharePoint hosting starts from $5. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable SharePoint Hosting, we should be your best choice.