I've been having a problem connecting to my sql 2000 server database.
The error reads...
Server Error in '/ASP' Application.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for
user 'NT AUTHORITY\NETWORK SERVICE'.
Source Error:
Line 30: //{
Line 31: Response.Write("before the open");
Line 32: objConn.Open();
Line 33: //SQLConnection.Open();
Line 34: //SqlCommand objCmd = new SqlCommand(sql,
objConn);
My web.config file reads:
<configuration>
<appSettings>
<add key="Andrew" value="Data Source=localhost;Initial
Catalog=Andrew;User Id=xxxx;Password=xxxxxxxxx"/>
</appSettings>
<system.web>
<compilation defaultLanguage="C#" debug="true" />
<customErrors mode="Off" />
<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" />
</system.web>
</configuration>
My connection string in my C# file reads...
protected SqlConnection objConn = new
SqlConnection(System.Configuration.ConfigurationSe ttings.AppSettings["Andrew"]);
What I've done so far:
Under security in SQL server I've set up an account with the ID. It
shows type as Standard, Server access as Permit and Default Database as
Andrew.
Under my SQL Server Login Properties I've set the Authentication to
"SQL Server Authentication" and entered the password.
Under the defaults menu I've set the database to Andrew.
Under server roles "System Admins" is checked.
Under the Database Access tab my user ID is assigned to the
"Andrew" database with a checkmark in the permit box.
Database roles for Andrew are set to public and db_owner.
I can't seem to find my way around this error. Any help would be
greatly appreciated!
Thanks,
Andrew
Andrew,
When using ASP.NET the default security contect is the service accoutn that
IIS is running under. This is called using a trusted conneciton. By default
this account is not given access to SQL Server; to resolve this you should
give the correct permissions to SQL Server so the account that IIS is
running under has permissions to access SQL. Your connection is currently
connecting in this mode.
Adding "Integrated Security=false" to your connection string will turn this
feature off (then you should be good to go).
If you are inclined to use Integrated Authentication you should
1. Add Integrated Security=SSPI (and remove the user and password from your
conneciton string)
2. <system.web>
<authentication mode = "windows" />
<identity impersonate="true" />
</system.web>
3. Then open the IIS Admin tool and go to the properties window of where
your application is running. You then choose the Directory Security tab and
uncheck Anonymous & provide the username and password for the user. This
changes the context of the applicaiton to run under your user.
4. Grant the appropriate privilages to the user.
Brad Sarsfield [MSFT] bradsa(at)microsoft.com
This posting is provided "AS IS", with no warranties, and confers no rights.
<andrew.grande@.gmail.com> wrote in message
news:1127878854.885819.309560@.g49g2000cwa.googlegr oups.com...
> I've been having a problem connecting to my sql 2000 server database.
> The error reads...
> Server Error in '/ASP' Application.
> Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
> Description: An unhandled exception occurred during the execution of
> the current web request. Please review the stack trace for more
> information about the error and where it originated in the code.
> Exception Details: System.Data.SqlClient.SqlException: Login failed for
> user 'NT AUTHORITY\NETWORK SERVICE'.
> Source Error:
> Line 30: //{
> Line 31: Response.Write("before the open");
> Line 32: objConn.Open();
> Line 33: //SQLConnection.Open();
> Line 34: //SqlCommand objCmd = new SqlCommand(sql,
> objConn);
>
> My web.config file reads:
> <configuration>
> <appSettings>
> <add key="Andrew" value="Data Source=localhost;Initial
> Catalog=Andrew;User Id=xxxx;Password=xxxxxxxxx"/>
> </appSettings>
> <system.web>
> <compilation defaultLanguage="C#" debug="true" />
> <customErrors mode="Off" />
> <globalization requestEncoding="UTF-8" responseEncoding="UTF-8" />
> </system.web>
> </configuration>
> My connection string in my C# file reads...
> protected SqlConnection objConn = new
> SqlConnection(System.Configuration.ConfigurationSe ttings.AppSettings["Andrew"]);
> What I've done so far:
> Under security in SQL server I've set up an account with the ID. It
> shows type as Standard, Server access as Permit and Default Database as
> Andrew.
> Under my SQL Server Login Properties I've set the Authentication to
> "SQL Server Authentication" and entered the password.
> Under the defaults menu I've set the database to Andrew.
> Under server roles "System Admins" is checked.
> Under the Database Access tab my user ID is assigned to the
> "Andrew" database with a checkmark in the permit box.
> Database roles for Andrew are set to public and db_owner.
> I can't seem to find my way around this error. Any help would be
> greatly appreciated!
> Thanks,
> Andrew
>
Tuesday, March 20, 2012
authentication error
Labels:
application,
asp,
authentication,
connecting,
database,
error,
failed,
ive,
login,
microsoft,
mysql,
oracle,
reads,
server,
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment