ReportViewer: Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" RRS feed

  • Question

  • Hi all,

    aspx pages with a reportviewer controls, I randomly get this error:

    The Following Error on /Reserved.ReportViewerWebControl.axd?OpType=SessionKeepAlive&ControlID=e52d7d9e14594b81adb7d37f7345b0f2 

    Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"C:\Windows\TEMP\4fpixag1.cmdline".

    Error Inner Exception: System.ComponentModel.Win32Exception (0x80004005): The directory name is invalid

    Source : System

    Error Stack Trace:    at System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine)

       at System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine)

       at Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options, String compilerDirectory, String compilerExe, String arguments, String& outputFile, Int32& nativeReturnValue, String trueArgs)

       at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)

       at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)

       at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)

       at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)

       at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)

       at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)

       at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)

       at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)

       at System.Web.Services.Protocols.SoapClientType..ctor(Type type)

       at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()

       at Microsoft.Reporting.WebForms.ServerReportSoapProxy..ctor(WindowsIdentity impersonationUser, String reportServerLocation, IEnumerable`1 headers, IEnumerable`1 cookies, EndpointVersion version)

       at Microsoft.Reporting.WebForms.ServerReport.get_Service()

       at Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession()

       at Microsoft.Reporting.WebForms.ServerReport.LoadViewState(Object viewStateObj)

       at Microsoft.Reporting.WebForms.ServerReport..ctor(SerializationInfo info, StreamingContext context)<br />

    Any idea? 



    Tuesday, March 27, 2012 11:56 AM

All replies

  • Hi Simo,

    i think Report File is not assigned with full path to ReportViewer Control.

    So check report File path is correct or not.



    Friday, March 30, 2012 10:41 AM
  • I am seeing the same problem on my server. Were you able to resove this issue?

    You can see more details at the following thread:

    Tuesday, April 24, 2012 4:39 PM
  • I am having this exact problem except we are using WinForms instead of Web.  Has anyone found a resolution to it yet?

    Our issue is sporadic.  It doesn't happen when we run from Visual Studio.  Once it is deployed to the computers users randomly get this error and have to try 2-3 times and eventually it will work.   It doesn't seem like a permissions issue.  Someone suggested that it might be our virus protection software?   Any ideas would be appreciated!

    Barb Cornell

    • Edited by barb_123 Thursday, January 16, 2020 6:21 PM
    Thursday, January 16, 2020 6:20 PM