Could not load file or assembly "App_Licenses.dll" " Could not load file or assembly App_Web_"

今天在AspDotNetStorefront做定制化开发,编译的时候莫名其妙地报告Could not load file or assembly 'App_Licenses, Version=0.0.0.0, Culture=neutral, ... (Exception from HRESULT: 0x80070057 (E_INVALIDARG))的错误,检查文件系统,发现文件还在,然后查看文件夹权限,也没有发现任何异样。于是Google。网上很多网友给出解决方案,比如:重启/重装ASP.NET,设置Network Service权限等等,结果无功而返。

后来我发现,不仅仅是这个App_Licenses.dll无法加载,就算我从References中删去这个引用,仍然会提示其它的DLL也无法加载的情况。而且,我重新安装一份新的AspDotNetStorefront应用也出现同样的问题。很明显,不是我解决方案本身的问题。

突然想起之前有过机器异常重启的经历,我估计是在异常重启的过程中造成了文件丢失或者损坏,于是先用iisreset/stop停止IIS服务,然后打开ASP.NET的临时文件夹(在32bit,.NET 2.0中,是),删除所有的文件和文件夹,再iisreset/start后,编译解决方案,一切正常。

这问题其实不复杂,但真正碰到这样的问题解决起来也挺难的。在此随笔一下,也希望能够帮到遇到同样问题的网友。

 

-------------------------------------------------------------------------------

 

如果你的2.0网站不是经过vs2005发不出来的,而是将cs文件和aspx文件一同上传的,可能会引发这个错误,其实是由于framework的临时文件造成的。  

Could Not Load File Or Assembly '...' Or One of Its Dependencies. Access Is Denied.

If you configure an ASP.NET 2.0 web application (or web service) to impersonate a user that is not a member of the Administrators group, and particularly if the application needs to load an assembly from the "bin" folder, then you may receive an HttpException ("Could not load file or assembly '...' or one of its dependencies. Access is denied."). This may happen because the impersonating user is denied write access on the "%systemroot%/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files" folder. You can find more information at the following location.

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconaspnetrequiredaccesscontrollistsacls.asp

Could not load file or assembly App_Web_*** ASP.NET

While loading an asp.net web page, it encounters the following error.

Could not load file or assembly 'App_Web_33cq6epw, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

The easy way to figure this out is to shut down IIS (iisreset /stop), then delete the temp asp.net files located in C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files (for .Net framework 2.0), and finally restart IIS (iisreset /start). It should work for you.

你可能感兴趣的:(Web,File,assembly,application,asp.net,Access)