2012年2月24日星期五

First connection from Vista client to SQL Server 2005 times out

This is very odd.
I have a VB6 application. I have fixed it up to play nice with Vista,
and embedded a manifest (contents at the end of this post) into the
exe.
When I try to connect to the SQl Server 2005 server from a Vista
client, I get a timeout on the first try. My app asks to verify the db
settings (server name, db name, etc.), and I do that, retry and it
connects fine. It does this every time. It only fails to connect on
the first try, it always connects on the second try.
The app has an optional second database it can connect to, and it does
the same thing. Times out on the first connection attempt, click the
retry connection button and it connects just fine.
But here's the weird part. If I recompile the app, and do not embed a
manifest, it works fine with no other changes. So the manifest is
cause this for some reason.
Here's what the connect string looks like:
Provider=SQLOLEDB;Server=10.0.0. 167;UID=;PWD=;DATABASE=thedb;Trusted_con
nect
ion=yes;Persist
Security Info=True
It doesn't matter if I use a trusted connection and "NT
authentication" or supply a user name/password for SQL Server
authentication. It doesn't matter if I put the server name or the IP
address. It always times out on the first connection and works on the
second connection, but only if there is a manifest embedded (otherwise
it connects fine on the first try).
(And yes, I'm aware the Persist Security Info is a no no -- the app
was copying the connect string around in a couple of places, and I'm
in the process of cleaning that up so this is temporary).
Here's what the manifest looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asinvoker"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
In this case, I am logged in from a domain user ID with domain
administrator permissions. Haven't even started trying to test it as a
mortal user yet.
Any suggestions?Problem solved.
The XP2 machine hosting the SQL Server 2005 recently had a third-party
firewall installed and it was not configured properly. The "SQL
Server" allows did not allow everything that was needed. Opening port
1433 for TCP fixed the problem.
So, it is not a Vista problem, or a SQL Server 2005 problem, or a
problem with our app. Just a firewall configuration problem.
Doesn't explain why the app works without a manifest, or why it
connects fine the second time (the server is setup to allow several
protocols, so maybe the client uses a different one if TCP/IP doesn't
work). Makes me suspect how good the firewall actually is, though.
Oh, and it USED to work from other clients (XP and Win2K), but not
after installing the firewall, which I confirmed after going back to
an XP client to test again to try to see what was different.
My bad, never mind, carry on...
On Jul 13, 4:18 pm, rn...@.rviews.com wrote:
> This is very odd.
> I have a VB6 application. I have fixed it up to play nice with Vista,
> and embedded a manifest (contents at the end of this post) into the
> exe.
> When I try to connect to the SQl Server 2005 server from a Vista
> client, I get a timeout on the first try. My app asks to verify the db
> settings (server name, db name, etc.), and I do that, retry and it
> connects fine. It does this every time. It only fails to connect on
> the first try, it always connects on the second try.
> The app has an optional second database it can connect to, and it does
> the same thing. Times out on the first connection attempt, click the
> retry connection button and it connects just fine.
> But here's the weird part. If I recompile the app, and do not embed a
> manifest, it works fine with no other changes. So the manifest is
> cause this for some reason.
> Here's what the connect string looks like:
> Provider=3DSQLOLEDB;Server=3D10.0.0.167;UID=3D;PWD=3D;DATABASE=3Dthedb;Tr=
usted_connec=ADtion=3Dyes;Persistseagreen">
> Security Info=3DTrue
> It doesn't matter if I use a trusted connection and "NT
> authentication" or supply a user name/password for SQL Server
> authentication. It doesn't matter if I put the server name or the IP
> address. It always times out on the first connection and works on the
> second connection, but only if there is a manifest embedded (otherwise
> it connects fine on the first try).
> (And yes, I'm aware the Persist Security Info is a no no -- the app
> was copying the connect string around in a couple of places, and I'm
> in the process of cleaning that up so this is temporary).
> Here's what the manifest looks like:
> <?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"yes"?>
> <assembly xmlns=3D"urn:schemas-microsoft-com:asm.v1"
> manifestVersion=3D"1.0">
> <trustInfo xmlns=3D"urn:schemas-microsoft-com:asm.v3">
> <security>
> <requestedPrivileges>
> <requestedExecutionLevel level=3D"asinvoker"/>
> </requestedPrivileges>
> </security>
> </trustInfo>
> </assembly>
> In this case, I am logged in from a domain user ID with domain
> administrator permissions. Haven't even started trying to test it as a
> mortal user yet.
> Any suggestions?

没有评论:

发表评论