SQL Connection problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Arda

    #1

    SQL Connection problem

    Hi all,
    I tried to connect a database(SQL) by both VS 2003 interface tools and
    normal typing.

    When I make the connection in subdirectory project it doesn't work and gives
    an
    error like this;

    Server Error in '/WebApplication1 ' Application.
    ----------------------------------------------------
    Login failed for user 'NT AUTHORITY\NETWO RK SERVICE'.

    Nevertheless, when I use the same .aspx page in normal web site (without any
    sub directory) it works without any error.

    I have been using Windows 2000 and it was both working but when I installed
    Windows 2003 Enterprise Edition, it started to give that error(below). So,
    most probably this error acquires because of Windows 2003 settings is there
    anyone who knows how to solve this problem?

    Kind Regards,
    Arda Coskun




  • Carl Prothman [MVP]

    #2
    Re: SQL Connection problem

    Arda,
    By default, the ASP.NET worker process on a Windows Server 2003 (IIS6)
    machine uses the local "NT AUTHORITY\NETWO RK SERVICE" user
    account. And on Windows 2000 / XP (IIS 5.x), it uses the local ASPNET .
    user account. Also, ASP.NET has impersonnation turned off by default.

    Hence, in this configuration, if you want your web page to access a Sql Server
    database, you'll need to give database access permissions to the corresponding
    local user account, depending on which IIS version you are using.

    Here is a summary for a machine called "CARLP7" on IIS 5.x,
    with Authentication mode="Windows" in web.config

    - If Identity impersonate="fa lse" and IIS Anon Access enabled
    => WindowsIdentity .GetCurrent().N ame = CARLP7\ASPNET

    - If Identity impersonate="fa lse" and IIS NTLM enabled
    => WindowsIdentity .GetCurrent().N ame = CARLP7\ASPNET

    - If Identity impersonate="tr ue" and IIS Anon Access enabled
    => WindowsIdentity .GetCurrent().N ame = CARLP7\IUSR_CAR LP7

    - If Identity impersonate="tr ue" and IIS NTLM enabled
    => WindowsIdentity .GetCurrent().N ame = CARLP7\Administ rator (logged on user)


    Here is a summary for a machine called "CARLP7" on IIS 6.0,
    with Authentication mode="Windows" in web.config

    - If Identity impersonate="fa lse" and IIS Anon Access enabled
    => WindowsIdentity .GetCurrent().N ame = NT AUTHORITY\NETWO RK SERVICE

    - If Identity impersonate="fa lse" and IIS NTLM enabled
    => WindowsIdentity .GetCurrent().N ame = NT AUTHORITY\NETWO RK SERVICE

    - If Identity impersonate="tr ue" and IIS Anon Access enabled
    => WindowsIdentity .GetCurrent().N ame = CARLP7\IUSR_CAR LP7

    - If Identity impersonate="tr ue" and IIS NTLM enabled
    => WindowsIdentity .GetCurrent().N ame = CARLP7\Administ rator (logged on user)

    --

    Thanks,
    Carl Prothman
    Microsoft ASP.NET MVP



    "Arda" <sac@simetriyaz ilim.com> wrote in message news:#f9q3kFVDH A.2364@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hi all,
    > I tried to connect a database(SQL) by both VS 2003 interface tools and
    > normal typing.
    >
    > When I make the connection in subdirectory project it doesn't work and gives
    > an
    > error like this;
    >
    > Server Error in '/WebApplication1 ' Application.
    > ----------------------------------------------------
    > Login failed for user 'NT AUTHORITY\NETWO RK SERVICE'.
    >
    > Nevertheless, when I use the same .aspx page in normal web site (without any
    > sub directory) it works without any error.
    >
    > I have been using Windows 2000 and it was both working but when I installed
    > Windows 2003 Enterprise Edition, it started to give that error(below). So,
    > most probably this error acquires because of Windows 2003 settings is there
    > anyone who knows how to solve this problem?
    >
    > Kind Regards,
    > Arda Coskun
    >
    >
    >
    >[/color]


    Comment

    Working...