问题
I have recently begun working with AJAX-Enabled WCF, and have been plagued with this .NET caching issue - Could not load file or assembly App__Web__hamznvwf
I was having issues with this 4 to 5 times a day on my server (Win 2003) - see first post
So I moved my files off of the server and started running the project locally (Win XP). Arghh! The issue came up again - locally. And it happened after a reboot! Do you think this is a network policy causing this issue on my local machine and server? Guess I am going to try to open
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
to Everyone. And see if this helps?
Any other things I should try before I call MS Support?
How do I delete my "AppNameFolder" in Temporary ASP.NET Files? I thought I could shutdown the built-in debugging web server and that would be it. Something is preventing me from deleting it.
回答1:
Wow, this one is a bit of a doozy. I did some research and apparently lots of people have been experiencing this problem for years. It's possible that you are caching types that are defined in your web site. Such types do not have an assembly, so one is randomly generated for them at runtime. The next time you recycle your web server, your types are given a different randomly generated assembly, and your cache won't be able to deserialize because the old assembly no longer exists. Here are some possible fixes you can try:
- Define all types in a separate assembly rather than in your web site.
- On your local box, see if running the site in webdev rather than iis has the same behavior.
- If you're using out-of-proc (SQL Server) session/cache storage, try using in-proc (local in-memory) session/cache storage
- Delete all subdirectories under C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files (as Dimi mentioned, use Unlocker to break locks any applications might have)
- If you precompile your web site when deploying, make sure your web server is shut down before deploying. (Apparently if users are requesting pages on the old version of the site, it will screw things up when the new version is deployed.)
回答2:
Have you tried disabling the indexing service? Also, it might be worthwhile to move to a Web application project and see if this problem persists.
回答3:
Additionally to what the previous poster said, I would suggest using a tool like this to determine where the problem lies.
来源:https://stackoverflow.com/questions/425015/asp-net-wcf-and-could-not-load-file-or-assembly-app-web-hamznvwf