How .Net names its temp folder inside C:\Windows\Microsoft.NET\Framework\v{version}\Temporary ASP.NET Files\root

[亡魂溺海] 提交于 2019-12-11 11:41:48

问题


I have some websites on my IIS machine. Lets say WebsiteA, WebsiteB and WebsiteC.

Inside .Net temp folder

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\{folderName}

each of the 3 website will have their own folder with some random name.

For example:

  • WebsiteA is using a folder named 5a3e1z1j. This folder will have the following path :

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\5a3e1z1j

  • WebsiteB is using a folder named b51o8881. This folder will have the following path :

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b51o8881

  • WebsiteC is using a folder named ad4966a9. This folder will have the following path:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ad4966a9

How do I know which website is using which folder? So while the process of that website is still running, it won't allow me to delete the folder. It will only allow to delete the folder if I kill the process / stop the application pool or IIS.

Then I did some testing, what if I delete the folder (of course while there is no running process), what will happen to the site.

So apparently it will create a new folder with same exact random name.

Then I come up with a conclusion that this name is stored somewhere, so even though the folder is deleted. It will be recreated back with the same name.

My question is "How .Net create the name of these .Net temp folder so that for each website will have a consistent folder name? If it's stored somewhere after a successful build of the website, where can I find it?"

What I am trying to achieve is I want to create a tool that will do application pool restart if it's given input of website name. And also at the same time delete the .Net temp folder. But only the one associated to the input website.

If something is not clear, please let me know.

Thanks

来源:https://stackoverflow.com/questions/22470028/how-net-names-its-temp-folder-inside-c-windows-microsoft-net-framework-vversi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!