简体   繁体   中英

asp.net compilation - temp file naming convention

Under heavy stress and load, our implementation of Cache with Virtual path provider is having issues with ASP.NET NOT clearing out the temporary files (compilation files) ie; Cache is updated but sometimes the ASP .NET compilation is holding the older compiled file and hence updated content is never displayed.

I am moved the temp file location to a different directory and trying to remove this file manually in my Cache Item Remove Call Back delegate without using REGEX. Currently, the files are being compiled as

filename.aspx.#HashCode#.compiled

The HashCode is based on the folder that the file is available ie; if I have the same file under 2 directories, I would get a similar temp. files with different hashcodes. Do we know how this HashCode is being generated based on the directory?

I have tried to get the hashcode from the virtual directory, from name of the virtual directory, from the virtual path, from the resolved file system path but none of them work with what is being created.

I noticed that the naming convention is arrived from Build Manager (GetCacheKeyFromVirtualPathInternal) at run time.

https://github.com/Microsoft/referencesource/blob/4.6.2/System.Web/Compilation/BuildManager.cs

I was able to implement the same for my clean up purpose but had to re-implement the GetStringHashCode method.( https://github.com/Microsoft/referencesource/blob/master/System.Web/Util/StringUtil.cs )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM