Interesting SQL Server/.NET behavior

C

Chris Stewart

We're having an issue here at school with trying to access a SQL
Server database from a .NET application. As a department, we roll out
a generic image to all of our lab computers. For some reason we were
getting "SQL Server does not exist or access denied" errors (
http://www.isy.vcu.edu/~cstewart/sqlerror.jpg ). One of the lab
machines in the lab worked fine and could connect without any issues.
As a quick fix, we re-imaged 3 of the machines that didn't work with
the one that did work. That resolved the issue for the current class
that needs to do this.

Today I went and downloaded one of the starter kits from asp.net (
http://asp.net/Default.aspx?tabindex=9&tabid=47 ). I downloaded the
package, installed it, and chose to do a remote install for SQL
Server. As requested, I logged into our central SQL Server machine
(the same server as mentioned above) using Query Analyzer from my
workstation and ran the 3 SQL scripts to create the needed database. I
double checked the user login given by the program and I can login via
Query Analyzer just fine. Yet when I run the application in VS.NET or
just locally in IE, I get the "SQL Server does not exist or access
denied" error mentioned above. The few people that have been working
with this problem are stumped. We all think there is some security
setting that hasn't been set properly which isn't allowing me to
connect to the database via the code.

Also, we tried to run the application on a machine outside of the
domain and it worked fine. The database was found and connected to
without any issues. I'd really appreciate any feedback as this has
really crippled our Universities opportunity to experiment with .NET.
 
D

Dino Chiesa [Microsoft]

you might want to check with
(a) the forums on www.asp.net - I think they have people there who do the
starter kits
(b) the newsgroup at microsoft.public.dotnet.framework.aspnet - this is a
bit closer than here.

It's usually pretty straightforward.
SQL allows 2 types of logins: Windows login, and SQL user/password.

Do you know which one the starter kit app is using?
If it is Windows login, have you setup ASPNET as an authorized user on SQL?
Have you verified the connection string points to the SQL server you think
it points to?

Using Query Analyzer - are you challenged for a user/password, or does your
SQL Server just allow you to connect without additional authentication? If
the latter, then it is using Windows login, and you need to enable the
ASPNET account, which is the Windows identity under which ASP.NET apps (like
the starter kit) run - you need to grant access to this identity to the
appropriate SQL serve databases and tables.
If the former, then you need to ensure this user/pw you use for QA is the
same one you use in the starter kit connection string. Typically this will
be provided in a config file, maybe it is in the web.config file for the
starterkit app. I don't know the starter kits, which is why I say "maybe".
web.config is a likely place for this info.

The other possibility is that the connection string is pointing to a bogus
server or a server where SQL is not running or not accessible. (maybe it is
"(local)" ). Check that as well.
 
S

sue

Are you using a firewall? We just had this same problem
and it was because SQL Server needed access on a
particular port and our firewall had blocked it.

-----Original Message-----
you might want to check with
(a) the forums on www.asp.net - I think they have people there who do the
starter kits
(b) the newsgroup at
microsoft.public.dotnet.framework.aspnet - this is a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top