Professional Web Applications Themes

ASPNET account and file access - ASP.NET Web Services

OK - I know this subject has been hased out many times before but I can't seem to figure this out. I have a Web service that needs to write to a logfile. The log is an XML file that is located in a subdirectory "logs" that is located under the application root. I have granted the local ASPNET account the privileges needed to read/write/create this file. It works perfectly on my development box (Win XP Pro) but when I move it to the a test box (Win2003 Server) I get the following access violation: UnauthorizedAccesception: Access to the path ...

  1. #1

    Default ASPNET account and file access

    OK - I know this subject has been hased out many times before but I can't
    seem to figure this out.

    I have a Web service that needs to write to a logfile. The log is an XML
    file that is located in a subdirectory "logs" that is located under the
    application root. I have granted the local ASPNET account the privileges
    needed to read/write/create this file. It works perfectly on my development
    box (Win XP Pro) but when I move it to the a test box (Win2003 Server) I get
    the following access violation:

    UnauthorizedAccesception: Access to the path
    "C:\Inetpub\wwwroot\XMServices\logs\test.xml" is denied.
    at System.IO.__Error.WinIOError(Int32 errorCode, String str)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
    bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share)
    at System.IO.File.Open(String path, FileMode mode)
    at CMServices.Sync.test.CreateXmlFile() in
    c:\inetpub\wwwroot\xmservices\sync\test.cs:line 41
    at CMServices.Services.Sync.Test() in
    c:\inetpub\wwwroot\xmservices\services\sync.asmx.c s:line 251
    The error message is pretty self explanitory but I can't seem to figure this
    out. I have gone so far as to give the ASPNET account "Full Access" to the
    logs directory and to it's parent - the application root ("xmservices").
    Any insight to this would be most welcome at this point.
    Charlie
    charlie@nunya.com Guest

  2. #2

    Default ASPNET account and file access

    OK - I know this subject has been hased out many times before but I can't
    seem to figure this out.

    I have a Web service that needs to write to a logfile. The log is an XML
    file that is located in a subdirectory "logs" that is located under the
    application root. I have granted the local ASPNET account the privileges
    needed to read/write/create this file. It works perfectly on my development
    box (Win XP Pro) but when I move it to the a test box (Win2003 Server) I get
    the following access violation:

    UnauthorizedAccesception: Access to the path
    "C:\Inetpub\wwwroot\XMServices\logs\test.xml" is denied.
    at System.IO.__Error.WinIOError(Int32 errorCode, String str)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean
    bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
    FileShare share)
    at System.IO.File.Open(String path, FileMode mode)
    at CMServices.Sync.test.CreateXmlFile() in
    c:\inetpub\wwwroot\xmservices\sync\test.cs:line 41
    at CMServices.Services.Sync.Test() in
    c:\inetpub\wwwroot\xmservices\services\sync.asmx.c s:line 251
    The error message is pretty self explanitory but I can't seem to figure this
    out. I have gone so far as to give the ASPNET account "Full Access" to the
    logs directory and to it's parent - the application root ("xmservices").
    Any insight to this would be most welcome at this point.
    Charlie
    charlie@nunya.com Guest

  3. #3

    Default Re: ASPNET account and file access

    I figured this out about 10 minutes after I posted this message.

    On the 2003 Server there is a user group called IIS_WPG (IIS Worker Process
    Group) that is not on my XP Pro box. It did not have sufficient rights for
    creating and updating files. Once I granted this group write access to the
    /logs/ directory, then everything worked as it should.

    Maybe somebody else can learn from my few hours of frustration.
    Charlie
    charlie@nunya.com Guest

  4. #4

    Default Re: ASPNET account and file access

    I figured this out about 10 minutes after I posted this message.

    On the 2003 Server there is a user group called IIS_WPG (IIS Worker Process
    Group) that is not on my XP Pro box. It did not have sufficient rights for
    creating and updating files. Once I granted this group write access to the
    /logs/ directory, then everything worked as it should.

    Maybe somebody else can learn from my few hours of frustration.
    Charlie
    charlie@nunya.com Guest

Similar Threads

  1. How to run aspnet with system account
    By Zeng in forum ASP.NET Security
    Replies: 22
    Last Post: April 8th, 12:40 PM
  2. Replies: 6
    Last Post: March 16th, 05:00 PM
  3. ASPNET Account
    By Rich in forum ASP.NET General
    Replies: 7
    Last Post: January 9th, 02:31 PM
  4. Replies: 1
    Last Post: October 19th, 06:55 PM
  5. Replies: 4
    Last Post: August 14th, 11:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139