XslCompiledTransform.Load() raises System.IO.FileNotFoundException
Asked Answered
A

5

7

My webapp (ASP.NET 2.0) consumes a webservice (asmx on 1.1 framework) on the same machine. After getting XML in return, I pass it to XslCompiledTransform for transform XML to HTML and it works fine.

Yesterday I got a System.IO.FileNotFoundException frequently and don't know what causes this kind of problem.

First look I thought it's about read/write permission on c:\windows\temp and then I made sure give it full permission for Network Service (also Everybody at last -_-!) but it doesn't help.

Any ideas or solutions would be appreciate.

-------------------- stack trace --------------------------
Exception: **System.IO.FileNotFoundException**
**Could not find file 'C:\WINDOWS\TEMP\sivvt5f6.dll'.**

   at System.IO.__Error**.WinIOError**(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 
rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CSharp.CSharpCodeGenerator.FromDomBatch(CompilerParameters options, CodeCompileUnit[] ea)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromDomBatch(CompilerParameters options, CodeCompileUnit[] ea)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromDom(CompilerParameters options, CodeCompileUnit[] compilationUnits)
   at System.Xml.Xsl.Xslt.Scripts.CompileAssembly(List`1 scriptsForLang)
   at System.Xml.Xsl.Xslt.Scripts.CompileScripts()
   at System.Xml.Xsl.Xslt.QilGenerator.Compile(Compiler compiler)
   at System.Xml.Xsl.Xslt.**Compiler.
Compile**(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil)
   at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
   at System.Xml.Xsl.**XslCompiledTransform.Load**(String stylesheetUri, XsltSettings settings, XmlResolver stylesheetResolver)
Actuality answered 7/11, 2008 at 5:8 Comment(0)
A
4

After checking for details and googling for the related topics,

  1. This problem found with .Transform() and also occures with XmlSerialization as Marc said. Christoph Schittko has a good article for troubleshooting.
  2. Someone said the problem may because some update patch of windows that can change the behavior of serializer.

    I called my administrator to clarify if there's any changes on our server and he said nothing changes and he suggest me for restarting.

    and Yes... my problem has been solved by.....restarting server (windows 2003 ;)

Actuality answered 8/11, 2008 at 1:17 Comment(1)
+1 We experienced the exact same error (File not found for a DLL in C:\Windows\Temp) for an XslCompiledTransform. It was fixed by a server restart.Amazed
P
1

OK, that's an interesting one. I've seen similar issues with serializers, but not with XslCompiledTransform specifically.

From the title, I was expecting it to be an issue loading included/imported transforms, which would probably have been fixable by supplying an XmlResolver. Not finding the self-generated dlls is very odd!

As a stop-gap (while you investigate the issue), you might want to see if it still happens with XslTransform. I realise this isn't ideal (given the optimisations etc in XslCompiledTransform), but it might at least let your app work while you investigate...

The first investigative thing I would do is look at the event log. Anything interesting? Also worth checking if your anti-virus software hasn't gone mad with false positives (unlikely).

The next thing I would do is isolate the app - i.e. snip off the 1.1 stuff - since you're calling it via an asmx page (to a separate application) it shouldn't be a factor, so you should (theoretically) be able to reproduce it just from a flat xml file. Ideally, it would be good to have a page (maybe an ashx for simplicity) in you project that just tries to do a transform from a local file.

Is it reproducable with simple xslt/xml? The simpler you can make the code that has an issue, the closer you are to either finding/fixing it, or having something that you can fire at MS via "connect".

Perforate answered 7/11, 2008 at 5:27 Comment(0)
A
1

Thanks a lot Marc for your response.

My xsl file has no external resource to be referenced to (no include, import) so XmlResolver should not be investigated.

The transform works fine in other server (I got 2 servers) and also in this server, after I did iisreset, it is getting works again. But before an hour, it comes again. I did check Event Viewer, and it logged the same error as I got!!

---------------- from Event Viewer ------------- Event Type: Warning

Event Source: ASP.NET 2.0.50727.0 Event Category: Web Event Event ID: 1309 Date: 11/7/2008 Time: 2:07:37 PM User: N/A Computer: XXXX Description: Event code: 3005 Event message: An unhandled exception has occurred. Event time: 11/7/2008 2:07:37 PM Event time (UTC): 11/7/2008 7:07:37 AM Event ID: f17058f2126c4a4abb1742a3099010b0 Event sequence: 25407 Event occurrence: 276 Event detail code: 0

Process information: Process ID: 1128 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE

Exception information: Exception type: FileNotFoundException Exception message: Could not find file 'C:\WINDOWS\TEMP\irdt-y8o.dll'. .....

Actuality answered 7/11, 2008 at 7:8 Comment(1)
Curious. I assume all 3 have the same config (in particular the temp dir setting in the main web.config/machine.config)?Perforate
H
1

just some ideas for troubleshooting:

  • Is the dll file created? You could check e.g. with Filemon from Sysinternals to see if the XSLT is actually compiled.
  • Is there enough free disk space?
  • How many files are in your temp folder? There might be problems with too many files in %TMP%
  • What else is running on the machine? Anything like Antivirus which might clean up the Temp folder?
Heywood answered 24/11, 2008 at 18:41 Comment(0)
C
1

I am experiencing the same problem on Windows Server 2003. Our ASP.NET application is consuming a web service (on an external machine across the web), and after a while we get this error message.

Running a recycle on the app pool fixes the problem, but i'm searching for an answer to the cause of the problem.

Anyone?

Chivaree answered 24/3, 2009 at 23:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.