XmlSerializer cannot find file C: \ Windows \ Temp \ *. Dll

I have an ASP.NET 2.0 web application running on a shared server from a well-known hosting provider. Sometimes I seem to get errors like this:

Could not find file 'C: \ WINDOWS \ TEMP \ lxnmfrsz.dll'. Description: An unhandled exception occurred during the execution of the current web request. View the stack trace for more information about the error and its occurrence in the code.

Exception Details: System.IO.FileNotFoundException: Could not find file 'C: \ WINDOWS \ TEMP \ lxnmfrsz.dll'.

I searched around and it seems like this is a common problem. One solution is to clear the temporary folder or restart IIS. Since I do not have access to these things on a server that I do not have, these are not really options. I tried setting the temp directory to another directory using the directive in web.config, but apparently it uses the default temporary files directory. Is there any other way to change the temp directory and / or solve this problem?

+4
source share
3 answers

If you always serialize the same type, you can try pre-generating the XmlSerializer executables with sgen.exe . In this case, the XmlSerializer will not look for them.

+7
source

The only caveat is that if generics are involved (for example, a list <> of your type), it is not possible to use sgen to pre-build the serializer assembly.

A workaround for this is to output from the <MyType> list with your own type, then include it in the pre-created assembly.

0
source

I could not change my project (Previous solution), so I need to find a solution for my client on the client’s site, and after a long time trying to find a solution by replacing Kaspersky antivirus, I finally found a solution. In IIS, right-click Sites and select Add Website ... and launch your website on a different port. That's all. Finished!!. yohaaaaa.

-1
source

All Articles