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

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

ServerVersion = 'Conn.ServerVersion' threw an exception of type 'System.InvalidOperationException

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net


I have a web service  which tries to connect to the SQL server.

It uses Integrated security = true.

I get the Conn.ServerVersion threw an exception of  type System.InvalidOperationException as soon as the connection object is instatiated.

Any leads.


View Complete Post

More Related Resource Links

The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.

 Hi all,When i run my project on my own computer, it works fine. But when i deploy it to server, it gives me this error. I can run my other dts and sp, but i get this error on this.. The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. I googled it but could not find a solution. How can i solve this problem? 

the type initializer for 'system.runtime.remoting.identity' threw an exception.

HI, I am trying to implement kerberos delegation in Active Directory enviroment with windows 2003 servers SP2. I have Client, ProxyServer and RemoteServer application that are developed on .Net framework v3.5 using .Net Remoting "System.Runtime.Remoting". I am not using Microsoft.Samples.Security.SSPI &  Microsoft.Samples.Runtime.Remoting.Security directly. my code is based on "http://blogs.msdn.com/dotnetremoting/archive/2006/07/06/662599.aspx" Only change that I have done is put impersonate="true" in channel configuration of ProxyServer and RemoteServer, and of course changed the UPN and Port and IP address. The Client's credentials are successfully impersonated by ProxyServer, I can access the text file on ProxyServer on behalf of client. But when from ProxyServer I try to execute the method on RemoteServer it throws "the type initializer for 'system.runtime.remoting.identity' threw an exception." After looking at blog http://www.secnewsgroups.net/group/microsoft.public.dotnet.security/topic8251.aspx I did required changing under Local Security Settings -> Local Policies -> User Rights Assignments -> impersonate a client after authentication and Create Global Objects. I have added three domain user names in three machine under whose credentials corrosponding application is running. When i run three applications on their

'schema.AllCategories' threw an exception of type 'System.UnauthorizedAccessException

We're porting a solution from 2007 to 2010 and we're having trouble accessing the CrawledProperties property from the Schema object. Other properties from the Schema object however are accessible (e.g. AllManagedProperties). It does not matter whether we use the obsolete SearchContext to create the Schema object, or the new SearchServiceApplication (Example code from Steve Curran here: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/2550e6e8-34a6-4012-969f-9657dc526d74) Now what's interesting is that the SAME user (Farm administrator) can access the AllCategories using a Windows Forms application, but when using a SharePoint solution (Codebehind on an application page) it doesn't work. We have double-checked that the executing user is the same. The same user can also browse the CrawledProperties using the Central Admin UI. We're experiencing this on several server installations, one of which is the "Standalone" installation of Search Server Express 2010, whereas the same user was used to perform the installation. I'd appreciate any ideas you might have.

Error 1259 The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.


In my asp.net application i  have getting an error

Error 1259 The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.  
 How to solve this one

I configured this application in iis.

As per the many forum result . i changed the framworkwortion in asp.net  tab of iis proprty.

So kindly give a good solution for it



@ Page AutoEventWireup="false" CodeFile="IDNotification.aspx.vb" Inherits="IDNotification" Language

Exception : The type initializer for 'System.Text.BaseCodePageEncoding' threw an exception



I'm getting a strange exception in the following situation:

Dotnet application written in C#.

Pinvoking a dll written in C++ in which I'm calling CoInitialise();

After calling functions inside the dll, a call to System.console.WriteLine or a call to SQLConnection.Open() throws the following exception.

If I start the program with System.console.WriteLine("Starting Application) , then it solves the problem, as if it had initialized the environnement correctly before pinvoking the dll.


Do you have a explanation of this strange behavior?



   at System.Text.BaseCodePageEncoding.FindCodePage(Int32 codePage)
   at System.Text.BaseCodePageEncoding.LoadCodePageTables()
   at System.Text.BaseCodePageEncoding..ctor(Int32 codepage, Int32 dataCodePage)
   at System.Text.Encoding.GetEncoding(Int32 codepage)
   at System.Data.SqlClient.TdsParser.ProcessEnvChange(Int32 tokenLength, TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternal

An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in system.dll

Additional information: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respondThis error occurs when i was executing a vc++.net program implementing ICMP....Error occurs when executing this statement... iRet=st->ReceiveFrom(RecvByte,RecvByte->Length,SocketFlags::None,&senderRemote);How to solve this problem????

A first chance exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll

I've read a bit about this error and maybe I have nothing to worry about.  BUT ... my simple little app gets 7 of these before it even gets to the first Dim statement in the Class Form1!  I found and followed instructions on how to have the Debugger intercept these exceptions but it seems that they are not being intercepted.  I only know that they have happened because of the messages in the Immediate Window.  In the Designer all I have is 5 Labels and 5 TextBoxes.   Any thoughts on how I could get to the cause of these messages? Thanks,  Bob

Exception of type 'System.ExecutionEngineException' was thrown.

Hi,       I am showing a WPF Window as ShowDialog().  Before loading the window, we are showing a message box. Upon Pressing Cancel Button from the Message box, Application throws "Exception of type 'System.ExecutionEngineException' was thrown.".. While cancelling, Events are raised to close the Window.. If we comment that code, window will be in the open state, other wise will "Throw the error". Please help me!!!!!!!!!  

Exception of type 'System.ServiceModel.FaultException`1' occurred in WCF library

Hi, While Throwing Custom Fault Exception, am getting the warning message as An exception of type 'System.ServiceModel.FaultException`1' occurred in IAuthentication.DLL but was not handled in user code But Fault Exception handled in Client Side Please let me know, How Can I suppress this warning? Regards, Ganesh

An unhandled exception of type 'System.Net.WebException' occurred in system.dll Additional inform

Hi , I am giving my functioon below. I am getting the error when  executing  "       streamInput = HTTPWebRequest.GetRequestStream                "   error is  An unhandled exception of type 'System.Net.WebException' occurred in system.dll  Additional information: The underlying connection was closed: Could not establish secure channel for SSL/TLS.  Sorry for my bad english  Private Function GetXMLMarkIntnlResponse(ByVal strRequest As String) As String         Dim HTTPWebRequest As HttpWebRequest         Dim HTTPWebResponse As HttpWebResponse         Dim Encoding As System.Text.UTF8Encoding         Dim byte1 As Byte()         Dim streamInput, streamOutPut As Stream         Dim strmReader As StreamReader         Dim strURL As String = "https://beta.triseptapi.com/9.0/vax.asmx"         HTTPWebRequest = CType(WebRequest.Create(strURL), HttpWebRequest)         HTTPWebRequest.Method = "Post"         HTTPWebRequest.ProtocolVersion = HttpVersion.Version11         HTTPWebRequest.C

Exception of type 'System.OutOfMemoryException' was thrown.

Hi, i am just using select stmt from some view. view defination is also selecting columns from inner join of 3 tables. view count is about 46 millions records. so while selecting from view it gives me: Exception of type 'System.OutOfMemoryException' was thrown. same error occur if i use direct select from those tables instead of select * from view. What is the reason behind this. Any help will be appreciated. Thanks Punia

need help about Exception of type 'System.Web.HttpUnhandledException' was thrown.

Hi Friends

I am developing a website in which i am using services of a third party service providers. after some transactions on their pages they are transfering control to my page say page1.aspx. 

But when the control is transfered to my page there is an exception /Runtime error..

I am unable to trace this error. I had tried to log all the errors. Where I found this error.

3/19/2010 3:34:44 AM
Offending URL: http://www.mydomain.com/ThankYou.aspx Source: System.Web Message: Exception of type 'System.Web.HttpUnhandledException' was thrown. Stack trace: at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.thankyou_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5910a9b6\ab96f081\App_Web_upsitg7y.0.cs:line 0
at System.Web.HttpApplication.CallHandlerEx

User Control Web Part - The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.



I need help, in our SharePoint 2007 project we have created Web Part using VS 2005 & .Net 2.0, User Control. In the user control for one of the drop down list box databinding method we are using data from IBM DB2. It works fine on our local machine, but after Web Part deployment if i open the page then the Drop Down List is empty. I checked the log in the event viewer. I found the following error message in the vent viewer -

The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.


Detail Error Message -

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/2076212728/Root

Process ID: 26880

Exception: System.TypeInitializationException

Message: The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.

StackTrace: at IBM.Data.DB2.DB2Connection.Finalize()

InnerException: System.InvalidOperationException

Message: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, tokens 9.1.1.DEF.2, SOFTWARE\IBM\DB2\InstalledCopies

StackTrace: at IBM.Data.DB2.y.f.a()

at IBM.Data.DB2.DB2ConnPool.g()

at IBM.Data.DB2.DB2ConnPool..ctor()

at IBM.Data.DB2.DB2Connection..cctor()

For more information, see Help and Support Center at h

A first chance exception of type 'System.Runtime.InteropServices.COMException'


After calling a very simple WCF Service I bind the result an Observable Collection of Countries to WPF ComboBox, in second ComboBox of cities I displayed the filtered cities based on the selected country. It works fine the first time but when I select another country it takes lots of time to display, the Visual Studio 2010 output displays this like 50 times:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Intereting to point out that it only happens if I try to open the ComboBox and not if if navigate through code doing something like SelectedIndex=2 . It does not happen as well if instead of the ComboBox I use a ListBox or TreeView.

Some extra details.... the real exception detail is:

An event was unable to invoke any of the subscribers (Exception from HRESULT: 0x80040201)

Please help with this bug....

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.


I get the following error anytime i change something in the XAML and try and build the project. If I change anything in the code behind it works everytime.... To get it to work i have to get out of the ide come back in place a space in one of the .vb files to change it then it will build..... Any ideas?


Error 107 The "ResourcesGenerator" task failed unexpectedly.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.IO.MemoryStream.set_Capacity(Int32 value)
   at System.IO.MemoryStream.EnsureCapacity(Int32 value)
   at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.BinaryWriter.Write(Byte[] buffer, Int32 index, Int32 count)
   at System.Resources.ResourceWriter.WriteValue(ResourceTypeCode typeCode, Object value, BinaryWriter writer, IFormatter objFormatter)
   at System.Resources.ResourceWriter.Generate()
   at System.Resources.ResourceWriter.Dispose(Boolean disposing)
   at Microsoft.Build.Tasks.Windows.ResourcesGenerator.Execute()
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) 

Error warming up the worker process. - Starting worker process threw - Inner Exception: System.Runti


Can anybody guide me how to resolve this on my production server,



Error warming up the worker process. - Starting worker process threw - Inner Exception: System.Runtime.Remoting.RemotingException: 4 arguments were passed to 'Microsoft.SharePoint.UserCode.ISPUserCodeWorkerProcessProxy::Initialize'. 3 arguments were expected by this method.    Server stack trace:      at System.Runtime.Remoting.Messaging.Message.CoerceArgs(MethodBase mb, Object[] args, ParameterInfo[] pi)     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)     at Microsoft.SharePoint.UserCode.ISPUserCodeWorkerProcessProxy.Initialize(Int32 appDomainCount, Boolean alwaysRecycleAppDomains, Byte[] salt, Boolean logRequests)     at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.InitializeWorkerProcess(ISPUserCodeWorkerProcessProxy workerProcessProxy, Boolean alwaysRecycleAppDomains, Byte[] saltBytes, Boolean logRequests)     at Microsoft.SharePoint.UserCode.

An exception of type 'System.Data.SqlClient.SqlException' occurred and was caught


When the Stored procedure is executed through SQL Server Management Studio, its taking 23 seconds

When the same Stored proc is called through web app, its throwing below copied exception. It is noticed that when the data is more than 100k records this exception is thrown other wise expected records are shown in UI. Another stored proc from the same app returns over 150k records without any excetpion.

Can't conclude that the exception is in Stored proc, because it works from SQL Server Management studio, but throws below exception from Web app.

Your help is appreciated in resolving this issue.

An exception of type 'System.Data.SqlClient.SqlException' occurred and was caught.
10/17/2010 16:56:01
Type : System.Data.SqlClient.SqlException, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Source : .Net SqlClient Data Provider
Help link : 
Errors : System.Data.SqlClient.SqlErrorCollection
Class : 11
LineNumber : 0
Number : -2
Procedure : 
Server : XXXXX
State : 0
ErrorCode : -2146232060
Data : System.Collection
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