R – XML Deserialization Permissions Error

iis-6visual-studio-2008windows-server-2003xml-serialization

I'm trying to use VS 2008 t publish a website to a virtual on my computer. The website runs just fine in VS2008 while debugging, but when I publish it, I'm getting the following error.

Access to the path 'C:\dummy.xml' is
denied. 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.UnauthorizedAccessException:
Access to the path 'C:\dummy.xml' is
denied.

ASP.NET is not authorized to access
the requested resource. Consider
granting access rights to the resource
to the ASP.NET request identity.
ASP.NET has a base process identity
(typically {MACHINE}\ASPNET on IIS 5
or Network Service on IIS 6) that is
used if the application is not
impersonating. If the application is
impersonating via , the identity
will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated
request user.

To grant ASP.NET access to a file,
right-click the file in Explorer,
choose "Properties" and select the
Security tab. Click "Add" to add the
appropriate user or group. Highlight
the ASP.NET account, and check the
boxes for the desired access.

I'm deserializing an XML file into a class built up by xsd.exe. The file and directory have the same permissions, and I can get to the xml file from a web browser. The service account being used to run / access the website (directory security settings in IIS) has full control permissions on the folder and the xml file.

I'm running Server 2003 R2 with IIS 6.

Any thoughts on how to correct this error?

Best Answer

Set a filemon (http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx) to monitor 'C:\dummy.xml'. When you'll get the error check which Windows user is trying to access the file.