ASP.NET调试目录监视httpexception
-
29-09-2019 - |
题
当我在调试模式下启动ASP.NET 4.0 Web应用程序时,我将获得以下例外:
System.Web.HttpException occurred
Message=Invalid file name for file monitoring: 'C:\src\main-232\src\ZNode\Znode_MultiFront\Web\Controls\Cat5\Navigation'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
Source=System.Web
ErrorCode=-2147024809
WebEventCode=0
StackTrace:
at System.Web.DirectoryMonitor.AddFileMonitor(String file)
InnerException:
问题是,该文件指向的文件是目录,那么为什么Visual Studio 2010认为这是一个文件?我正在本地机器上的IIS 7上运行此操作
解决方案
好消息:它似乎没有任何敲门效果
坏消息:我还没有找到原因或解决方案
解决方法:禁用脱节 HttpException
(debug->异常),并将其过滤在日志中。您仍然可以通过在调试模式下捕获其他httpexception Application_Error
(如果您暗示了这一点 - 但无论如何都应该有)
其他提示
我遇到了同样的问题,并检查 Enable Just My Code
选项中的复选框选项: Tools->Options->Debugging->General
, ,我让它起作用。
故障排除时我有类似的例外 HttpException
出现 Application_Error
本身在重定向到错误/索引操作时。我不得不取消选中 HttpException
在调试>异常对话框中以删除此错误。然后,它按照预期的是错误/索引,而无需从这个神秘的例外产生任何副作用。当时,Visual Studio处于调试模式。
不隶属于 StackOverflow