Where are the Assemblies for an ASP.NET Web Site When Running IIS Express

落爺英雄遲暮 提交于 2019-12-08 15:07:31

问题


I know that with dynamic compilation under an ASP.NET Web Site, code behind files get compiled into Assemblies. Where do these DLL's get stored when running IIS Express? Is it in memory only? I don't see them in the bin folder, or in the temp directory (C:\Windows\Microsoft.NET\Framework[64]\v4.0.30319). Typically I generate them when precompiling them whenever I publish. In this case, though, I don't see them.

Am I missing something?

Thanks.

UPDATE:

I did see dll's under C:\Users\Administrator\AppData\Local\Temp\Temporary ASP.NET Files\root

So I'm thinking it stores them there? This is Visual Studio 2012, .NET 4.5.


回答1:


Please refer to this: http://msdn.microsoft.com/en-us/library/e22s60h9%28v=vs.85%29.aspx

It really should be in your Bin folder.

This is additional info for framework 4.5: http://msdn.microsoft.com/en-us/library/hh475319.aspx




回答2:


It's quite likely not your bin folder. Everything gets copied into a set of temp folders.

I wrote a method for just this problem -

private string[] GetAssembly(string[] assemblyNames)
{
    string [] locations = new string[assemblyNames.Length];

    for (int loop = 0; loop <= assemblyNames.Length - 1; loop++)       
    {
         locations[loop] = AppDomain.CurrentDomain.GetAssemblies()
           .Where(a => !a.IsDynamic && a.ManifestModule.Name == assemblyNames[loop])
           .Select(a => a.Location)
           .FirstOrDefault();
    }
    return locations;
}

See this post I wrote on the topic - http://nodogmablog.bryanhogan.net/2015/05/finding-the-location-of-a-running-assembly-in-net/



来源:https://stackoverflow.com/questions/18200650/where-are-the-assemblies-for-an-asp-net-web-site-when-running-iis-express

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