Unable to generate a temporary class
If you use serialisation then IIS dynamically compiles the extra classes it needs to perform the serialisation and it uses the Windows temporary folders to store the class files definition and class compilation artefacts. If IIS can't write to the temporary folder you will get this error message:
Server Error in '/application' Application.
Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\Windows\TEMP\1kcmvhly.0.cs' could not be found
error CS2008: No inputs specified
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.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\Windows\TEMP\1kcmvhly.0.cs' could not be found
error CS2008: No inputs specified
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\Windows\TEMP\1kcmvhly.0.cs' could not be found
error CS2008: No inputs specified
]
System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) +1357
System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) +2809
System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) +366
System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) +951
WebApplication1.LicenseManager.getLicenceRequestResult(String url) in D:\views\davidne_view\kernel\WIP\WebApplication1\WebApplication1\LicenseManager.cs:16
WebApplication1.LicenseManager.obtainLicenseKey(String version, String feature, String sessionid, String username) in D:\views\davidne_view\kernel\WIP\WebApplication1\WebApplication1\LicenseManager.cs:33
WebApplication1.LicensedSessionModule.OnPreRequestHandlerExecute(Object source, EventArgs e) in D:\views\davidne_view\kernel\WIP\WebApplication1\WebApplication1\LicensedSessionModule.cs:55
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
If IIS can't create files in that folder then the application will fail at runtime so, you must give IIS write access to C:\windows\temp
.
- Right click on
C:\windows\temp
select Properties. - Select the Security tab.
- Click Edit
- When the Permissions for Temp dialgue box opens click Add.
- In the Enter the object names to select(example) box enter iis_iusrs.
- Click Check Names and the system will change the name to HOST\IIS_IUSRS. Click OK.
- Highlight IIS_IUSRS (HOST\IIS_IUSRS) and in the Permissions for IIS_IUSRS box, check all the security boxes in the Allow column. You can't check Special permissions so ignore that one.
- Then OK all the way out.
It moans about changing permissions on system folders so just click Yes to that. Now you should be able to reload the page without a problem.
There is a way to get around it by recompiling the classes needed for serialisation but I'll save that one for another time.
3 comments
Comment from: h mehta [Visitor]
Comment from: Pradeep Thakur [Visitor]
Thanks for our help . It worked. Thanks a lot.
Regards, Pradeep
Form is loading...