.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Cannot generate SSPI context. (.Net SqlClient Data Provider)

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :Sql Server

I have upgraded SQL SERVER 2000 standard edition server to SQL server 2008 with SP1 standard edition. No errors noticed. OS is Windows server 2003 with sp2, Service accounts are configured using domain user account, and mixed mode authentication is enabled.

Both windows and SQL authentications are working fine from the local (server), able to access all SQL server resources.

Server is accessible remotely using SQL authentication, but unable to connect with windows authentication, though user has local admin and SQL admin rights on the server.

Let me know any solutions for this. Appreciate your support

View Complete Post

More Related Resource Links

.Net SqlClient Data Provider connecting as sa

I recently changed the sa password on a SQL 2005 std sp3 default instance. I now see .Net SQL data provider connecting with sa login from an app server. From a trace I see: Application name: .Net Sql Client data provider NTUserName: sqluser LoginName: sa HostName: app server name LoginSID: SID for sa SessionLoginName: ssd\sqluser Sqluser is a sql server logon that is not sa. SSD\sqluser is local admin on app server and is not sa on SQL SERVER and is not in builtin/administrators either. I thought an existing session may explain it but both the app server and sql server have been restarted since the sa p/w change. Could I be misinterpreting the Profiler output? Any ideas?

Login failed for user 'sa'. (.Net SqlClient Data Provider)

Hi,     I am able to login using windows Authentication to my DB server. But when I am trying using Sql server authentication "sa" then following error is coming:   =================================== Cannot connect to .. =================================== Login failed for user 'sa'. (.Net SqlClient Data Provider) ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476 ------------------------------ Server Name: . Error Number: 18456 Severity: 14 State: 1 Line Number: 65536 ------------------------------ Program Location:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)    at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) &

Cannot Generate SSPI context, strange?

I recently put into affect some applications for data entry and searches connecting to a SQL 2008 database. When a user logs in and starts the application they are able to enter data. The data save to the database fine, then randomly we get crashes saying: "Unhandeled exception while running screen" its a SSPI error.... strangley enough if i log out and log back in, it again allows the program to enter into the database.... but surely enough after a few entries it gives me the error again. We are a small company, and the server we run AD on is pretty slugish, so loging out and back in... can to say the least take some time. This makes our productivity alot lower. If anyone has a fix or has any suggestions id gladly take them. Both Servers we use have Server 2008R2.

Here we go, "Cannot generate SSPI Context"

When trying to register a SQL Server in my SSMS on my desktop, I get the error.  My AD account is in the SQL Server as sysadmin.  When I go to the box, I can connect from SSMS with my AD account.  I dont see how its DNS, cause I can ping it by name from my desktop.  Any other ideas? remote connections are allowed enabled TCP/IP and Named Pipes In the server Event Viewer>Security, I get Failure Audit, user: system, Reason: Unknown user name or bad password BUT, I also get a Success Audit with my domain account.  

Login failed for user (.Net SqlClient Data Provider)


I have a dedicated server, which runs windows server 2003 web edition. I access the server using remote desktop. I have installed sqlserver express 2005 on the server, along with management studio express. I have problem running the sql script that would install the database. It says that remote connection is disabled by default on sql express 2005. So this is what I did ( as suggested by this article: http://www.datamasker.com/SSE2005_NetworkCfg.htm):
Enable the TCP/IP protocol using the Surface Area Configuration Utility 
Make sure the TCP/IP protocol is enabled in the SQL Server Configuration Utility 
Make sure the SQL Server browser is started.
Make sure SQL Server and SQL Server Browser are exempted by the firewall on the server machine. sqlservr.exe and sqlbrowser.exe as an exception in the windows firewall

Still no success. Reading various articles on internet, a few suggested i should grant access to certain user by running the following command

The problem is that i keep getting the error login failed, even when i try to connect to the sqlserver using management studio. When I use remote desktop it logins as administrator.
Can someone please

cannot generate sspi context


when connect to SQL 2000 sp3 on windows 2003 sp2 from SSMS 2008, get "cannot generate sspi context", but can connect to other SQL2000 server instances.

this one uses Windows authentication only, and I am using windows authentication to connect.

Cannot Generate SSPI Context Error - SQL 2000


Hi, We are still on SQL Server 2000 and just changed our internet provider which also changed some DNS' internally. We have Microsoft Access programs that connect to our local SQL Server to operate. The server we are trying to connect to is on the local network. I am constantly getting "Cannot Generate SSPI Context" errors and any of the fixes I find are completely greek to me. Some help would be much appreciated.


Thank You Very Much.

Error " cannot generate SSPI Context Sql Server Network interfaces"


Hi all,

I am getting an error while creating OLEDB connection in SSIS Package as following

test connection failed because of an error in initializing provider.Cannot generate SSPI context Sql server network interfaces: the local security authority cannot be contacted.

I have SQL server 2008 R2 version running on local server. I am able to connect to the SQL server using Windows authentication. But when i try to create OLEDB connection in SSIS package i am getting above error.

SQL Browser is running.

I have even checked SQL server configuration and Named pipes are enabled. But still i am getting the same error.

Any idea where to look would be of great help?



Need Oracle Data Provider .CS File for Oracle 10g Database connection !



I need a 'Wrapper.cs' file which takes care of the Database connection ( Oracle 10g) where

i can just call the method with my SQL Query


Gridview1.DataSource = SampleWrapper.ExecuteDatatable("THE SQL QUERY");


Plz Post the link if there is any open source !    

WCF The Security Support Provider Interface (SSPI) negotiation failed


I am using a wcf service that I created, when both hosting machine and the client machine are on the same domain everything works just fine. When I publish the client app to the webserver in the DMZ I am getting the following error:

SOAP security negotiation with '' for   
'' failed. See inner exception  
for more details.The Security Support Provider Interface (SSPI) negotiation failed.

Here is my service main where I set up the service


 Uri baseAddress = new Uri("Http://");
      ServiceHost selfHost = new ServiceHost(typeof(QBService), baseAddress);


ADO.NET: Building a Custom Data Provider for Use with the .NET Data Access Framework


The System.Data.dll assembly in the .NET Framework contains namespaces whose base classes can be used to create custom data providers. These namespaces also define a number of data access interfaces and base classes that let developers create data providers that will interoperate with other custom providers. Using the ADO.NET classes Connection, Command, DataReader, and DataAdapter, writing a provider is easier than writing one for OLE DB. This article explains these classes and their implementation, and how they can be used to write a variety of different kinds of data providers.

Bob Beauchemin

MSDN Magazine December 2001

Generate Test Data


Entering test data can be a tedious chore. Recently I found a web site that makes it easier to populate your database tables with realistic data, http://www.generatedata.com/ This is a very useful online utility. It really saves me a lot of time because I often waste an incredible amount of time just deciding on a name for a fictitious user. I also waste time looking for real addresses, phone numbers, etc. 

I wish I had thought of this as a project because it would have been easy to create and it gives you a certain amount of fame with other programmers. There are a few improvements that could be made to it so maybe somebody in the ASP.NET community could create an alternative service with the following improvements:

  1. Generate random amounts in various currencies. Don't know why the original version overlooks this obvious need.
  2. Add SQL Server and Access to the database choices.
  3. Generate random floats
  4. Generate random boolean values
  5. Fixed string values. You can sort of do this by entering a custom list with just one value.

Trying to run a stored procedure from vb code with oracle data provider.



Here is my SP:

create or replace
 Open p_getuserssignon_recordset1 for
 SELECT Distinct(Userid), UserPassword, SecurityLevel, ActiveStatus
WHERE substr(UserId,1,2) <> vUid
Order By UserId;

I would like to run this SP from code and fill a gridview with the result. 

I am not sure how to go about this, as I have found several different examples, other than the one I  think I need.

I am using the oracle data provider and I have an input parameter (vUid, which will equal "zz").

First question. When filling a gridview with a result set from a stored procedure should the recordset OUT be defined as a REFCURSOR (like i did above)? 


Do you have example code as to how to execute the SP and fill a gridview?  I keep trying different variations of code i've found on the internet without any success other than getting more confused.

(I am using VS 2005, VB).

Thank you.



System.Data.SqlClient.SqlException: Login failed for user . Reason: The account is disable


Hi All,

Thank you for advance.

I created a widows service for mail schedule with c#.net and sql server 2005 and it is working fine for past one year.

now sometimes i am getting the "System.Data.SqlClient.SqlException: Login failed for user '<UserName>'. Reason: The account is disabled." error.

then i restarted the windows service manually and working.

what is the problem in my sql server connection and how to fix that issue?

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlCli

I have created a windows library control that accesses a local sql database I tried the following strings for connecting Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true" Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"   I am not running the webpage in a virtual directory but in C:\Inetpub\wwwroot\usercontrol and I have a simple index.html that tries to read from an sql db but throws the error System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)   at System.Security.PermissionSet.Demand()   at System.Data.Common.DbConnectionOptions.DemandPermission()   at System.Data.SqlClient.SqlConnection.PermissionDemand()   at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, etc etc  The action that failed was:DemandThe type of the first permission that failed was:System.Data.SqlClient.SqlClientPermissionThe Zone of the assembly that fa

System.Data.SqlClient.SqlException: Bulk load data was expected but not sent

Hi everyone We've had this error twice now from our C# code. Nothing is changing the columns, but I've noticed though that it appears to happen when two threads are attempting to bulk insert into the same table, generally millions of rows. The docs say that SqlBulkCopy.WriteToServer is not guaranteed to be thread-safe, but is this the problem here? It feels like it. I've seen some posts where people appeared to have experienced problems in similar circumstances (http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/85d51484-6381-46bc-bcce-63b58b362d2d). There is no identity column just a non-unique clustered index that is (spid) process keyed to each thread. Do I need to synchronise access to the table for WriteToServer - is this a known problem? Many thanks Reg --- System.Data.SqlClient. SqlException: Insert bulk failed due to a schema change of the target table.   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)   at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal()   at System.Data.SqlClient.SqlBulkCo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend