When you call a Web service in a Microsoft ASP.NET Web application, you may receive the following error:
You may receive the error if one of the following conditions is true:
The worker process does not have permissions to read to the process Temp directory, and the worker process does not have permissions to write to the process Temp directory.
Note The XmlSerializer class generates and compiles code on the fly to perform serialization and deserialization. XmlSerializer uses Code Document Object Model (CodeDom) to perform the compilation. CodeDom compilation uses temporary files on a disk. If the worker process does not have the read permissions on the Temp directory and the write permissions on the Temp directory, then all calls to the Web service fail. Therefore, the worker process requires the read permissions on the Temp directory and the write permissions on the Temp directory.
There are compilation errors in the code that XmlSerializer generated.
Worker Process Account Permissions on the Temp Directory
To resolve this problem, the ASP.NET worker process account (the ASPNET account or the NETWORK SERVICE account if your application is deployed on Internet Information Services [IIS] 6.0) must have read access and write access on the Temp directory.
Note If you use impersonation, the impersonated user must have full access on the Temp directory.
To assign required permissions to the worker process account on the Temp directory, follow these steps:
In Microsoft Windows Explorer, locate the %windir%\temp directory.
Right-click %windir%\temp, and then click Properties.
In the Properties window, click the Security tab.
Click Add, type ServerName\ASPNET, and then click OK.
Note Replace ServerName with the name of the Web server.
Replace ASPNET with NETWORK SERVICE if you deployed your application on IIS 6.0.
Under Allow, click to select the Full Control check box, and then click OK.
Find Compiler Errors in the Code That XmlSerializer Generated
To find errors that are generated by the compiler, you must add a switch to the Web.config file to keep compiler-generated files. To do this, follow these steps:
Open the Web.config file in a text editor, such as Notepad.
Add an XmlSerialization.Compilation switch to the system.diagnostics section of the code, as follows: