very strange problem with connection

  • Thread starter Thread starter Trapulo
  • Start date Start date
T

Trapulo

I've two copy af the same asp.net application. The application enter on sql
server, working with two separate databases (on the same sql server
instance, of course). The connection is made with integrated security, and
the server is a domain controller.

If I start only the first application (call the web site), all right.
If I start only the second application, all right.

If I start an application, and then call a page from the second, my second
application cannot enter the database. If I kill aspnet process, the recall
the same page, this second application works fine, but I have the previuos
error if now I try to enter the first application!

This is a very strange problem!

What can I do?
 
Hi Trapulo,

I'm not quite sure how this happens due to lack of information. Would you
please tell me if the two applications are on the same server? Can you try
the following to see if it can work?

1. Currently, you're using integrated security, would you change the
authentication to SQL authentication and login with the sa account for both
applications?

2. Are you using connection pooling in SQL server? If yes, please comfirm
the maximum connections allowed.

3. Please close any connection after they are used in code.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Reply-To: "Trapulo" <[email protected]>
| From: "Trapulo" <[email protected]>
| Subject: very strange problem with connection
| Date: Sat, 18 Oct 2003 10:39:53 +0200
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: host191-10.pool80116.interbusiness.it 80.116.10.191
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63945
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| I've two copy af the same asp.net application. The application enter on
sql
| server, working with two separate databases (on the same sql server
| instance, of course). The connection is made with integrated security, and
| the server is a domain controller.
|
| If I start only the first application (call the web site), all right.
| If I start only the second application, all right.
|
| If I start an application, and then call a page from the second, my second
| application cannot enter the database. If I kill aspnet process, the
recall
| the same page, this second application works fine, but I have the previuos
| error if now I try to enter the first application!
|
| This is a very strange problem!
|
| What can I do?
|
|
|
 
Kevin Yu said:
Hi Trapulo,

I'm not quite sure how this happens due to lack of information. Would you
please tell me if the two applications are on the same server?

Yes of course. They are on two separate applications on the same web site.

Can you try
the following to see if it can work?

1. Currently, you're using integrated security, would you change the
authentication to SQL authentication and login with the sa account for both
applications?

I've tried, but is the same thing.
2. Are you using connection pooling in SQL server? If yes, please comfirm
the maximum connections allowed.

Yes. But this is made with default configuration (I've not inserted specific
tag in connection string to enable or disable the pool), so I think all is
the default behavior of ADO.NET..
3. Please close any connection after they are used in code.

This is done.


The only "strange" think I have in this application is that it doesn't use
direct SQL Client, but generic OLEDB Provider (I know this is not the best
way, but there is a reason) and this part of the application uses ADO with
interop to read the data (it is an old module upgraded without porting to
complete ado.net).

The connection string is:
Provider=SQLOLEDB;Trusted_Connection=yes;app=User_Application;data
source=myserver\myinstance;DataBase=dbname;Persist Security Info=False;

As I said, the connection works only for the first application to start.



The code that is executed at application startup is:

Public Function ValidateUser(ByVal login As String) As ADOR.Recordset

Const mCode As String = "3020202"

If Len(login) = 0 Then

Err.Raise(vbObjectError + 601, mCode, "Parametri mancanti o non validi")

End If



On Error GoTo EH



Dim conn As New ADODB.Connection()

conn.ConnectionString = mConnString

conn.Open()

Dim cmd As New ADODB.Command()

cmd.ActiveConnection = conn

cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc

cmd.CommandText = "_usr_UserBYLOGIN_GET"

cmd.Parameters.Append(cmd.CreateParameter("@login",
ADOR.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput, 15,
login))

ValidateUser = New ADOR.Recordset()

ValidateUser.CursorLocation = ADOR.CursorLocationEnum.adUseClient

ValidateUser.Open(cmd, , ADOR.CursorTypeEnum.adOpenForwardOnly,
ADOR.LockTypeEnum.adLockReadOnly)

System.Runtime.InteropServices.Marshal.ReleaseComObject(ValidateUser.ActiveC
onnection)

ValidateUser.ActiveConnection = Nothing

System.Runtime.InteropServices.Marshal.ReleaseComObject(cmd)

cmd = Nothing

conn.Close()

System.Runtime.InteropServices.Marshal.ReleaseComObject(conn)

conn = Nothing



EH:

If Not (cmd Is Nothing) Then

System.Runtime.InteropServices.Marshal.ReleaseComObject(cmd)

cmd = Nothing

End If

If Not (conn Is Nothing) Then

conn.Close()

System.Runtime.InteropServices.Marshal.ReleaseComObject(conn)

conn = Nothing

End If



myLog.WriteEntry("Errore " & mAppName & ": User.Data_User.ValidateUser: " &
Err.Description & vbCrLf & "; " & "login=" & login, EventLogEntryType.Error)

If Err.Number = -2147217873 Then

Err.Raise(vbObjectError + 602, mCode, Err.Description)

Else

Err.Raise(vbObjectError + 603, mCode, Err.Description)

End If
 
Hi Trapulo,

This issue is quite strange. So I need more information on this.

1. What's the version and edition of your SQL server? Have you installed
enough licences on it?

2. Try to create two administrator accounts sa1 and sa2 in SQL server, and
logon with sa1 for the first application and sa2 for the second.

I'll make further research to help you resolve this problem.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Reply-To: "Trapulo" <[email protected]>
| From: "Trapulo" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: very strange problem with connection
| Date: Mon, 20 Oct 2003 11:11:45 +0200
| Lines: 147
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: host130-10.pool80116.interbusiness.it 80.116.10.130
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:64040
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
|
| | > Hi Trapulo,
| >
| > I'm not quite sure how this happens due to lack of information. Would
you
| > please tell me if the two applications are on the same server?
|
| Yes of course. They are on two separate applications on the same web site.
|
| Can you try
| > the following to see if it can work?
| >
| > 1. Currently, you're using integrated security, would you change the
| > authentication to SQL authentication and login with the sa account for
| both
| > applications?
|
| I've tried, but is the same thing.
|
| > 2. Are you using connection pooling in SQL server? If yes, please
comfirm
| > the maximum connections allowed.
|
| Yes. But this is made with default configuration (I've not inserted
specific
| tag in connection string to enable or disable the pool), so I think all is
| the default behavior of ADO.NET..
|
| >
| > 3. Please close any connection after they are used in code.
|
| This is done.
|
|
| The only "strange" think I have in this application is that it doesn't use
| direct SQL Client, but generic OLEDB Provider (I know this is not the best
| way, but there is a reason) and this part of the application uses ADO with
| interop to read the data (it is an old module upgraded without porting to
| complete ado.net).
|
| The connection string is:
| Provider=SQLOLEDB;Trusted_Connection=yes;app=User_Application;data
| source=myserver\myinstance;DataBase=dbname;Persist Security Info=False;
|
| As I said, the connection works only for the first application to start.
|
|
|
| The code that is executed at application startup is:
|
| Public Function ValidateUser(ByVal login As String) As ADOR.Recordset
|
| Const mCode As String = "3020202"
|
| If Len(login) = 0 Then
|
| Err.Raise(vbObjectError + 601, mCode, "Parametri mancanti o non validi")
|
| End If
|
|
|
| On Error GoTo EH
|
|
|
| Dim conn As New ADODB.Connection()
|
| conn.ConnectionString = mConnString
|
| conn.Open()
|
| Dim cmd As New ADODB.Command()
|
| cmd.ActiveConnection = conn
|
| cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
|
| cmd.CommandText = "_usr_UserBYLOGIN_GET"
|
| cmd.Parameters.Append(cmd.CreateParameter("@login",
| ADOR.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput,
15,
| login))
|
| ValidateUser = New ADOR.Recordset()
|
| ValidateUser.CursorLocation = ADOR.CursorLocationEnum.adUseClient
|
| ValidateUser.Open(cmd, , ADOR.CursorTypeEnum.adOpenForwardOnly,
| ADOR.LockTypeEnum.adLockReadOnly)
|
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(ValidateUser.ActiveC
| onnection)
|
| ValidateUser.ActiveConnection = Nothing
|
| System.Runtime.InteropServices.Marshal.ReleaseComObject(cmd)
|
| cmd = Nothing
|
| conn.Close()
|
| System.Runtime.InteropServices.Marshal.ReleaseComObject(conn)
|
| conn = Nothing
|
|
|
| EH:
|
| If Not (cmd Is Nothing) Then
|
| System.Runtime.InteropServices.Marshal.ReleaseComObject(cmd)
|
| cmd = Nothing
|
| End If
|
| If Not (conn Is Nothing) Then
|
| conn.Close()
|
| System.Runtime.InteropServices.Marshal.ReleaseComObject(conn)
|
| conn = Nothing
|
| End If
|
|
|
| myLog.WriteEntry("Errore " & mAppName & ": User.Data_User.ValidateUser: "
&
| Err.Description & vbCrLf & "; " & "login=" & login,
EventLogEntryType.Error)
|
| If Err.Number = -2147217873 Then
|
| Err.Raise(vbObjectError + 602, mCode, Err.Description)
|
| Else
|
| Err.Raise(vbObjectError + 603, mCode, Err.Description)
|
| End If
|
|
|
|
|
|
|
 
Kevin Yu said:
Hi Trapulo,

This issue is quite strange. So I need more information on this.

Yes, it is very strange :(
First time I have a so bad problem with ado
1. What's the version and edition of your SQL server? Have you installed
enough licences on it?

SQL Server 2000 standard edition SP3a, installed on a windows 2000 server
SP4. Net framework 1.1
I've only the server itself accessing to sql, and all other applications
(asp net or com+ accessing sql server) are running without problem, so I
think it is not a licence problem..
The server is a domain controller with also installed Exchange2000 SP3,
MSXML4, Diskeeper, Winzip, and nothing else.
2. Try to create two administrator accounts sa1 and sa2 in SQL server, and
logon with sa1 for the first application and sa2 for the second.

I've tried, but I have the same behavior. Very very very strange.... :(((

Thanks
 
Hi Trapulo,

I think you can try to debug the application. Please trace into the code
and see where is the exception thrown and what's the error message. You can
also use SQL Profiler to trace the information on SQL server to see is
there any problem connecting to the SQL server.

If that still can't resolve the problem, please feel free to reply to the
post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Reply-To: "Trapulo" <[email protected]>
| From: "Trapulo" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: very strange problem with connection
| Date: Tue, 21 Oct 2003 10:18:21 +0200
| Lines: 29
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: host102-11.pool80116.interbusiness.it 80.116.11.102
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:64122
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
|
| | > Hi Trapulo,
| >
| > This issue is quite strange. So I need more information on this.
|
| Yes, it is very strange :(
| First time I have a so bad problem with ado
|
| > 1. What's the version and edition of your SQL server? Have you installed
| > enough licences on it?
|
| SQL Server 2000 standard edition SP3a, installed on a windows 2000 server
| SP4. Net framework 1.1
| I've only the server itself accessing to sql, and all other applications
| (asp net or com+ accessing sql server) are running without problem, so I
| think it is not a licence problem..
| The server is a domain controller with also installed Exchange2000 SP3,
| MSXML4, Diskeeper, Winzip, and nothing else.
|
| > 2. Try to create two administrator accounts sa1 and sa2 in SQL server,
and
| > logon with sa1 for the first application and sa2 for the second.
|
| I've tried, but I have the same behavior. Very very very strange.... :(((
|
| Thanks
|
|
|
 
Kevin Yu said:
Hi Trapulo,

I think you can try to debug the application. Please trace into the code
and see where is the exception thrown and what's the error message.

It doesn't work.
On my development system (windows 2000 Server SP4, SQL Server developer SP4)
if I start a copy of the application, and then start an other copy (pointing
to different SQL DB, as in production environment) with the debugger, all
two applications work fine!

You can
also use SQL Profiler to trace the information on SQL server to see is
there any problem connecting to the SQL server.

With profiler I see that the second application makes a "login", and next a
"logout" to the sql server, and no other operation. Does this mean that it
enters in sql server and then something wrong happen?

Thanks
 
Hi Trapulo,

Can you please provide us with the exact error message that you get when
you try logging from the second machine?
Can you recover from this failure at all or would the failure persist with
second application at all login attempts?

Thanks,
Ammar Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights
 
Ammar Abuthuraya said:
Hi Trapulo,

Can you please provide us with the exact error message that you get when
you try logging from the second machine?

Hi Ammar,
the error I have in event log is:
Errore APPNAME User.Data_User.ValidateUser: Object reference not set to an
instance of an object.

; login=administrator

(if you check my previius message you can see why it has this structure).

I know that "object not se"t, in this pattern of data access methods (as I
said to Kevin I know it's not the newest and best style, but the code come
fron a vb6 component adapted for .net, mantaining ado-com and vb6 error
handling statements... ), is when the connection is not opened by the
connection.open method.

But today (and strating from today: I have checked the entire log) I have a
new error!

Errore APPNAME User.Data_User.ValidateUser: No remoting information was
found for this object.

; login=administrator

The only new thing is that yesterday I've installed JetSP8 and restarted the
server. No other changes.
Can you recover from this failure at all or would the failure persist with
second application at all login attempts?

No, I cannot enter the second application until I shutdown the first
running.

Thanks
 
Hi Trapulo,

Thanks for getting back to me on this issue.

We have an existing bug with ADO interop where if you place the ADODB.dll
in the bin directory of two
applications, Some of the the ADODB.Recordset.Fields collection would be
dereferenced and thus a problem would occur when trying to access via the
second application.

Take a look at the following KB:
810098 BUG: Object Reference is Not Set to an Instance of an Object
http://support.microsoft.com/?id=810098

Try removing the adodb.dll from each of the bin directories (for your
applications), placed it in it's own
folder, registered it using regsvr32:
regsvr32 "C:\<path>\adodb.dll"

Then register it in the Global Assembly Cache using gacutil:
gacutil -i C:\<path>\adodb.dll

Hope this helps...

Let me know please how it goes with you.

Ammar Abuthuraya
Microsoft Developer Support
PSS Webdata

This posting is provided as is without any warrantee and confers no rights
 
Yesssssssssssssss!!! This solves my problem!

I had only a little problem with the workaround. When I try to register
adodb.dll with regsvr32 I get the error "adodb.dll was loaded, but the
dllregisterserver entry point was not found".
And if I try to register with gacutil, I have the error: "the dinamic
library msvcr70.dll could not be found..."

So, I have only copied the adodb.dll in c:\winnt\assembly and deleted the
local copy from the applications. Now the two applications are running!!

Thanks, I appreciate a lot you assistance.
 
Back
Top