asp.net“找不到文件” - 没有对文件的引用!

时间:2022-02-15 05:37:26

I'm working with asp.net (I'm a designer) and at some point during debugging it'll throw me and I'll get to an Exception objErr in the code - and when I hover it says "file not found". I assume it's an image but I've been searching and can't find anyway to pinpoint which file is missing. I hope this is enough information - if anyone could give me a direction I'll really appreciate it!

我正在使用asp.net(我是一名设计师),在某些时候调试它会抛出我,我会在代码中找到一个Exception objErr - 当我在悬停时说“找不到文件” 。我认为它是一个图像,但我一直在搜索,无论如何都找不到确定哪个文件丢失。我希望这是足够的信息 - 如果有人能给我一个方向我会非常感激!

AB

5 个解决方案

#1


1  

Find FileMon which is in the SysInternals package from Microsoft and run it when you get near to your file issue, maybe add a filter to filter out all of the OS file operations.

从Microsoft查找位于SysInternals包中的FileMon,并在接近文件问题时运行它,可能会添加一个过滤器来过滤掉所有操作系统文件操作。

You'll be able to see a file not found or access denied entry for the file if you have it set up right.

如果设置正确,您将能够看到文件未找到或访问被拒绝的条目。

I use FileMon all the time, it is free and really helps when troubleshooting permission and file IO problems.

我一直使用FileMon,它是免费的,在解决权限和文件IO问题时非常有用。

Ryan

#2


0  

I think you have not given full path for the image which you are searching.

我认为你还没有为你正在搜索的图像提供完整的路径。

Another problem which might be possible is when it throws an error check the page in your url and check if that page exists in your project. I wish I could help you more but I need more info for that,

另一个可能的问题是当它抛出错误时检查你网址中的页面并检查你的项目中是否存在该页面。我希望我能帮助你更多,但我需要更多信息,

#3


0  

Do you really have no information on which file is not found?

你真的没有关于找不到哪个文件的信息吗?

It is probably a misspelled filename (1 character typo's can be hard to find). So if you don't have the missing filename, debugging can be a real horror.

它可能是拼写错误的文件名(很难找到1个字符拼写错误)。因此,如果您没有丢失的文件名,调试可能是一个真正的恐怖。

#4


0  

Take a look at the IIS log produced, Found at: C:\WINDOWS\system32\LogFiles\W3SVC1\ and search for a 403 or similar.

看看生成的IIS日志,发现于:C:\ WINDOWS \ system32 \ LogFiles \ W3SVC1 \并搜索403或类似内容。

#5


0  

When referencing a file inside your project always add a "~" in front. This means that the path after the "~" sign is relative to the projects root folder.

在项目中引用文件时,始终在前面添加“〜”。这意味着“〜”符号后面的路径相对于项目根文件夹。

Example:
If an .Aspx file called "Example.asp" is located in the Pages folder inside the project you want to reference it as

示例:如果名为“Example.asp”的.Aspx文件位于项目内的Pages文件夹中,则要将其引用为

<asp:HyperLink ID="lnkExample" runat="server" NavigateUrl="~/Pages/Example.aspx"> Example</asp:HyperLink>

I hope this helps a bit.

我希望这能有所帮助。

#1


1  

Find FileMon which is in the SysInternals package from Microsoft and run it when you get near to your file issue, maybe add a filter to filter out all of the OS file operations.

从Microsoft查找位于SysInternals包中的FileMon,并在接近文件问题时运行它,可能会添加一个过滤器来过滤掉所有操作系统文件操作。

You'll be able to see a file not found or access denied entry for the file if you have it set up right.

如果设置正确,您将能够看到文件未找到或访问被拒绝的条目。

I use FileMon all the time, it is free and really helps when troubleshooting permission and file IO problems.

我一直使用FileMon,它是免费的,在解决权限和文件IO问题时非常有用。

Ryan

#2


0  

I think you have not given full path for the image which you are searching.

我认为你还没有为你正在搜索的图像提供完整的路径。

Another problem which might be possible is when it throws an error check the page in your url and check if that page exists in your project. I wish I could help you more but I need more info for that,

另一个可能的问题是当它抛出错误时检查你网址中的页面并检查你的项目中是否存在该页面。我希望我能帮助你更多,但我需要更多信息,

#3


0  

Do you really have no information on which file is not found?

你真的没有关于找不到哪个文件的信息吗?

It is probably a misspelled filename (1 character typo's can be hard to find). So if you don't have the missing filename, debugging can be a real horror.

它可能是拼写错误的文件名(很难找到1个字符拼写错误)。因此,如果您没有丢失的文件名,调试可能是一个真正的恐怖。

#4


0  

Take a look at the IIS log produced, Found at: C:\WINDOWS\system32\LogFiles\W3SVC1\ and search for a 403 or similar.

看看生成的IIS日志,发现于:C:\ WINDOWS \ system32 \ LogFiles \ W3SVC1 \并搜索403或类似内容。

#5


0  

When referencing a file inside your project always add a "~" in front. This means that the path after the "~" sign is relative to the projects root folder.

在项目中引用文件时,始终在前面添加“〜”。这意味着“〜”符号后面的路径相对于项目根文件夹。

Example:
If an .Aspx file called "Example.asp" is located in the Pages folder inside the project you want to reference it as

示例:如果名为“Example.asp”的.Aspx文件位于项目内的Pages文件夹中,则要将其引用为

<asp:HyperLink ID="lnkExample" runat="server" NavigateUrl="~/Pages/Example.aspx"> Example</asp:HyperLink>

I hope this helps a bit.

我希望这能有所帮助。