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 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.
Can someone help? Something tells me it's security issue.
Have you checked the following:
.txt
extension? .htm
extension to say the ASP ISAPI filter and accidentally removed the StaticFile handler? .jpg
, .gif
, .pdf
etc? Kev has covered most of the possible problems, but for reference there is another possibility.
Confirm that in Request Filtering
you either
.txt
as an Allowed extension, or Allow unlisted file name extensions
ticked in Edit Request Filtering Settings The same effect can be achieved with the following web.config section:
<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.
Add the MIME-Typ by going to ...
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. In my case it turned out that static files are served from a subdirectory called 'wwwroot' by default. Creating that subdirectory and moving the file in their solved it for me:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.