[英]404 error with IIS 7.0
I have a text file that I am trying to browse to using the browser http://files.mydomain.com/test.txt
and I get a: 我有一个文本文件,我试图浏览到使用浏览器http://files.mydomain.com/test.txt
,我得到一个:
HTTP Error 404.0 - Not found
I double checked and the text file does exist. 我仔细检查,文本文件确实存在。 When I add a test.htm
file, I have no issues. 当我添加test.htm
文件时,我没有任何问题。
Can someone help? 有人可以帮忙吗? Something tells me it's security issue. 有些东西告诉我这是安全问题。
Have you checked the following: 你检查了以下内容:
.txt
extension? 是否为.txt
扩展名设置了mime类型? .htm
extension to say the ASP ISAPI filter and accidentally removed the StaticFile handler? 例如,映射.htm
扩展名以说明ASP ISAPI过滤器并意外删除了StaticFile处理程序? .jpg
, .gif
, .pdf
etc? 你可以提供其他静态内容,如.jpg
, .gif
, .pdf
等吗? Kev has covered most of the possible problems, but for reference there is another possibility. Kev已经涵盖了大部分可能存在的问题,但作为参考,还有另一种可能性。
Confirm that in Request Filtering
you either 在Request Filtering
确认您
.txt
as an Allowed extension, or 将.txt
作为允许的扩展名,或 Allow unlisted file name extensions
ticked in Edit Request Filtering Settings 在“ 编辑请求过滤设置”中选中“ Allow unlisted file name extensions
” The same effect can be achieved with the following web.config section: 使用以下web.config部分可以实现相同的效果:
<system.webServer>
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".txt" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
Also make sure also that the website is started. 还要确保网站已启动。 I was getting 404 and then realized that the Default Website was stopped because another website (Sharepoint) was using port 80. Sometimes the obvious is what gets you. 我得到404,然后意识到默认网站已经停止,因为另一个网站(Sharepoint)正在使用端口80.有时显而易见的是什么让你。
Add the MIME-Typ by going to ... 通过转到...添加MIME类型
et voila et voila
I know this is an old post, but this might still help somebody out. 我知道这是一个老帖子,但这可能仍然有助于某人。 I ran into this problem with my Asp.Net Core application. 我用我的Asp.Net Core应用程序遇到了这个问题。 In my case it turned out that static files are served from a subdirectory called 'wwwroot' by default. 在我看来,默认情况下,静态文件是从一个名为'wwwroot'的子目录中提供的。 Creating that subdirectory and moving the file in their solved it for me: 创建该子目录并移动文件,为我解决了它:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/index?view=aspnetcore-2.2&tabs=windows#web-root https://docs.microsoft.com/en-us/aspnet/core/fundamentals/index?view=aspnetcore-2.2&tabs=windows#web-root
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.