日期:2013-11-27  浏览次数:20985 次

在visual studuo.net中调试 asp.net程序时出现过多次“hash.web”访问被拒绝的情况,查看程序代码又没有发现问题,重启IIS也不能解决,唯有重启电脑才恢复正常。

通过百度找不到解决办法,唯有用google搜索一下外国网站,找到如下tips:

http://blogs.wwwcoder.com/deepak/archive/2004/10/14/885.aspx
Access to the path containing 'hash.web' is getting denied.

After installing Visual Studio .NET and F5 a couple of times, I used to get this error frequently. The only resolution was to wait for upto 5 to10 mins or restart system, since a folder in Temporary ASP.NET files containing web.config gets locked up automatically.

After searching a while in KBs, Forums, I found one closest matching solution, which solved my problem. Just wanted to share with other readers who would also be experiencing this issue. The problem occurs significantly if you touch web.config and ASP.NET has significant memory consumption (as seen in Windows Task Manager)

There is a service called Indexing Service which runs in the system. During F5, ASP.NET tries to JIT compile the new dll (as my understanding goes) and when simultaneously ASP.NET and Indexing service goes to the specified set of cache files, the deadlock occurs and ASP.NET throws this exception.

Solutions【解决方法】:

Keep Indexing Service Manual or Stop It
In Indexing Service Preferences, Make C:/Winnt/Microsoft.NET to be excluded or placed in the exclusion catalog so that Indexing Service will not access this location.

---
Actually this solved another problem we are facing here. Thanks for the tip. The problem is like this:
One of the collegues @ my work place had a working VS .NET installation and was happily working on ASP.NET. Sometime later he was not able to debug the asp.net applications through VS .NET, changed config files ran aspnet_regiis, uninstalled VS .NET and reinstalled it completely so many times. No use, nada, zilch. So, we finally said "Take Care" that workstation, and gave him another one. Now after reading your post, I found Indexing Service was running on that machine. So I stopped it, reinstalled VS.NET and it is fine. Just fine. Thanks for the tip.
------------------------------------

http://weblogs.asp.net/bsimser/archive/2004/11/04/252512.aspx

Access denied to your own ASP.NET application
Every have a bad day with your ASP.NET app? Ever get the yellow screen of death with this on it:

Access to the path "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\myapp\5607edd7\fc4d1071\hash.web" is denied.

If you go googling for the problem, you'll find a few suggestions, solutions, ideas, and rants. We had the same problem happen at our shop a few times in the same week. In fact, it got to the point where we (the users in the local Administrator group) couldn't even access the folders themselves.

After putting our proverbial minds to work, we did something fairly simple. We reclaimed ownership of the folders. You can do this in the security tab of the ASP.NET Temporary files directory.

Right click and select "Properties"
Select the "Security" tab
Click on the "Advanced" button
Select the "Owner" tab
Select the owner (MACHINENAME\Administrators), check the "Replace owner on subcontainers and objects" and click OK
Voila. Problem gone. App working again. Everyone is happy.