Roland Schaer
Roland Schaer

Reputation: 1668

Cannot generate SSPI context exception after publishing mvc application to web server

After publishing a new version of my MVC app to our development web server I got the following error (abridged with account name redacted) :

Event code: 3005 
Account name: xxx\xxxxxxxx 
Exception type: SqlException 
Exception message: The target principal name is incorrect.  Cannot generate SSPI context. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

What is causing the exception?

Upvotes: 5

Views: 8991

Answers (2)

Mayank Jain
Mayank Jain

Reputation: 235

I was also facing the same issue. This was because my application is using windows authentication and defined in web.config.

Also need to change the property of web application in solution to Windows Authentication "Enabled" which is by default "Disabled".

This helps me!!

Upvotes: 0

Roland Schaer
Roland Schaer

Reputation: 1668

The issue was with a service account that we use to run our websites. I put in a request to have the accounts created and they were mistakenly set up to have the passwords expire. So everything worked great until the password expired.

Since this is a new medium priority app it was being developed in small increments over a period of several months by one developer. As a result the website did not get used very much.

The solution is to reset the password on the service account and make sure that it is set to never expire. Shut down the app pool. Update the password for the service account and then restart the app pool.

Upvotes: 12

Related Questions