C
Craig Wagner
I'm trying to better understand the role of the NT AUTHORITY\NETWORK SERVICE
and how it works with respect to SQL Server connections.
First some background and then the question.
I have a very simple test web page that does the following:
using( SqlConnection dbConnection = new SqlConnection( "Data
Source=server;Initial Catalog=db;Integrated Security=True" ) )
{
dbConnection.Open();
DataSet ds = new DataSet();
DbDataAdapter adapter = new SqlDataAdapter( "select statement",
dbConnection );
adapter.Fill(ds);
gridView.DataSource = ds;
gridView.DataBind();
}
I put this web app on two different Windows 2003 servers, one that is in my
domain at work and one that is in my domain at home. In each environment the
connection information points to a database that is local to that environment
(i.e. I'm not trying to hit a database in my home domain from work or vice
versa), but on a different machine than the web server. In both cases the web
app is in an application pool where the Identity tab indicates it should used
the Predefined Network Service account.
At the top of the page I display the values from Environment.UserDomainName
and Environment.UserName. In both environments this information displays as
NT AUTHORITY and NETWORK SERVICE respectively.
So here's the thing I can't figure out...
At work, the web app tries to connect to the database as
domain\machinename$. At home the web app tries to connect to the database as
NT AUTHORITY\NETWORK SERVICE.
What's up with that? Any pointers as to where to look for more information?
and how it works with respect to SQL Server connections.
First some background and then the question.
I have a very simple test web page that does the following:
using( SqlConnection dbConnection = new SqlConnection( "Data
Source=server;Initial Catalog=db;Integrated Security=True" ) )
{
dbConnection.Open();
DataSet ds = new DataSet();
DbDataAdapter adapter = new SqlDataAdapter( "select statement",
dbConnection );
adapter.Fill(ds);
gridView.DataSource = ds;
gridView.DataBind();
}
I put this web app on two different Windows 2003 servers, one that is in my
domain at work and one that is in my domain at home. In each environment the
connection information points to a database that is local to that environment
(i.e. I'm not trying to hit a database in my home domain from work or vice
versa), but on a different machine than the web server. In both cases the web
app is in an application pool where the Identity tab indicates it should used
the Predefined Network Service account.
At the top of the page I display the values from Environment.UserDomainName
and Environment.UserName. In both environments this information displays as
NT AUTHORITY and NETWORK SERVICE respectively.
So here's the thing I can't figure out...
At work, the web app tries to connect to the database as
domain\machinename$. At home the web app tries to connect to the database as
NT AUTHORITY\NETWORK SERVICE.
What's up with that? Any pointers as to where to look for more information?