To resolve this issue, use one of the following methods.
(The methods are listed in the order of preference.)
Method 1
Modify the compiler definition for the
C# compiler to include the
/nostdlib option. The
/nostdlib option prevents the
import of the mscorlib.dll assembly, which defines the entire
System namespace.
To include the
/nostdlib option in the C#
compiler definition on a computer, follow these steps:
- Open the Machine.config file, and then locate the <compilers> section.
- In the <compiler> definition for C#, add the compilerOptions attribute with a value of /nostdlib. For example:
<compiler language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System,
Version=1.0.3300.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089"
warningLevel="1"
compilerOptions="/nostdlib" />
Note The
compilerOptions attribute is not additive. If you need to override this option in
a Web.config file or on a given page, you must add the
/nostdlib option in
addition to your customizations.
Note You cannot use this method for applications that use the
XmlSerializer class or Web services because the compiler invocation that
XmlSerializer uses does not inherit these options.
Method 2
Grant List permissions to the process identity that is being used to run the ASP.NET
worker process for every folder in the path of the mscorlib.dll assembly. Typically, this path
is %WinDir%\Microsoft.NET\Framework\
Version.
This is generally the root of the volume where the account does not have
permissions. For example, the root may be C:\.
Note Do not use this method if the following conditions are true:
- You use the /nostdlib option.
- You
are not using Web services.
Method 3
Grant "List Folder/Read
Data" permissions to one of the following accounts:
- The ASPNET account, or the NetworkService account for
applications that run on Microsoft Internet Information Services (IIS)
6.0
- The group that includes the ASPNET account (or NetworkService
account)