Groups | Blog | Home
all groups > iis security > september 2007 >

iis security : Why doesn't ASP.NET 2.0 use the Network Service account


Homer
9/22/2007 12:50:25 AM
Hi,

I have an asp.net 2.0 Intranet app that is installed to a Win2003
Server running IIS 6.0. This production server also hosts asp.net 1.1
apps also. I isolated the two into separate application pool on the
IIS. My Intranet app loads but on login authentication, for some
strange reason, IIS passes in a network user account rather than the
Network Service account. Naturally authentication failed because the
database is set up to allow Network Service in and not the network
user account, which I know nothing about. This same Intranet app
works fine in the test server that also runs on Win2003 server with
IIS 6. I spent two days on this and I can't go any further. Does
anybody knows what is going on? Thank you for your help in advance.

Thanks,
Jon
David Wang
9/22/2007 12:17:42 PM
[quoted text, click to view]


ASP.Net is flexible and allows configuration of user account to run
its code.

By default for ASP.Net 2.0 it is process identity, which is Network
Service on IIS6 by default. If you do not see that, it means that you
either configured the Application Pool to use another user identity,
or you configured ASP.Net to use another identity.

In either case, the problem is not "why doesn't ASP.NET 2.0 use the
Network Service account", nor is it "why is IIS passing in a network
user account". The problem is "Why did the user misconfigure the wrong
user account for their application and don't even know it".

Because by default, it should just work, according to your other
configuration..


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
Ken Schaefer
9/23/2007 10:37:00 PM
As David says, something is up with your configuration:

Places to check:
a) What is the web application pool configured to use in IIS Manager?

b) Do you have <impersonation> enabled in your web.config file for the
application?

Cheers
Ken

--
My IIS Blog: www.adOpenStatic.com/cs/blogs/ken

[quoted text, click to view]
Homer
9/24/2007 8:09:15 AM
On Sep 23, 5:37 am, "Ken Schaefer" <kenREM...@THISadOpenStatic.com>
[quoted text, click to view]

Hi,

I created a new application pool in IIS 6 to isolate my asp.net 2.0
apps from asp.net 1.1 apps. I left the pool configuration at default
and verified that the predefined identity is "Network Service". I
have the same configuration in the test server and it works just
fine. I do not turn on imperation in my app so by default IIS should
use the Network Service account. Here's my web.config:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/
v2.0">
<appSettings>
</appSettings>
<connectionStrings>
<add name="csHumanResources" connectionString="Data
Source=prodSql;Initial Catalog=HumanResources;Integrated
Security=SSPI" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.net>
<mailSettings>
<smtp>
<network host="10.162.22.1"/>
</smtp>
</mailSettings>
</system.net>
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Default.aspx" timeout="10"
slidingExpiration="true" />
</authentication>
<membership defaultProvider="CustomizedProvider">
<providers>
<add name="CustomizedProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="csEmployeeSelfService"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
applicationName="EOIntranet" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
<roleManager enabled="true"
defaultProvider="CustomizedRoleProvider">
<providers>
<add connectionStringName="csEmployeeSelfService"
applicationName="EOIntranet"
name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>
<pages styleSheetTheme="Forest"/>
<compilation debug="true">
<assemblies>
<add assembly="System.Web.Extensions.Design,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/
[quoted text, click to view]
<add assembly="System.Design, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Configuration, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Services, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.DirectoryServices, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.DirectoryServices.Protocols,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.EnterpriseServices, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.ServiceProcess, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.RegularExpressions, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Drawing.Design, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
<siteMap defaultProvider="AspXmlSiteMapProvider" enabled="true">
<providers>
<add name="AspXmlSiteMapProvider" siteMapFile="web.sitemap"
type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true"/>
</providers>
</siteMap>
</system.web>
</configuration>

Thanks,
Jon
Tiago Halm
9/26/2007 11:17:28 PM
The impersonation could eventually be set at the root level.
To make sure set
<identity impersonate="false" />
Leave no room for assumptions.

Other options are to set a sample .ashx file on the AppDomain where you're
seeing this and dump the WindowsIdentity account.

Tiago Halm

AddThis Social Bookmark Button