Friday, March 23, 2012

No connection

Hello,

New development machine with Sql Server Express and Visual Web Developer.

I created a database then tried to connect from a test page on localhost and it worked. Then I tried from the internet domain and could not. So under the

Surface Area Configuration, I change the Remote Connections to Using both TCP/IP and named pipes and restarted the Database Engine. But

I still could not connect. So I restarted the machine. Now I can't view the page on localhost either. I can view a different web page so the Web server is

working.

I get the following as the exception:Error reading the database: Cannot open user default database. Login failed.Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

My connection string is: "Data Source=.\SQLEXPRESS;Integrated Security=True;AttachDBFilename=|DataDirectory|Externalresearch.mdf;User Instance=True"

Any suggestions?

Okay I found out why. If I have Web Developer open (with the database connection open) I cannot connect from the browser. But

if I close Web Developer then I can connect from the browser (ie, view my test page).

Is this because it's the same machine that I am both viewing the web page and hosting Sql server (ie, the user can only be used once)?


|||

Hi,

It's a little strange that it says you're using the Network Service to connect to SQL Server.

Are you connecting to the SQL Server through Internet with the windows authentication? If so, that's not supported, since the windows identity cannot be passed through internet.

|||

Kevin,

Everything including the database is on one machine. I'm using Windows authentication. So when I'm in Visual developer and connect

to the database, my web page (again hosted on the same machine) cannot connect to the database. It's a new installation of everything

with defaults setup. How can I work on the database while my web pages can still access the database? I just downloaded Managament

Studio Express, will this do?

Thanks for any help

|||

Hi,

Yes, you can use Management Studio to grant database access permission to the Network Service account.

By default, it does not have permission to the SQL Server. After granting the access, it will be working fine, I think.

sql

No comments:

Post a Comment