3

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.

2
  • What turned out to be the problem? Commented Feb 4, 2010 at 16:19
  • It was the mime type issue. Thanks for pointing me in the right direction Commented Feb 4, 2010 at 23:43

5 Answers 5

3

Have you checked the following:

  1. Your DNS 'A' record for 'files' is pointing to the correct IP address
  2. If your server is using a shared IP address across multiple sites have you configured a HTTP host header?
  3. Is there a mime type set for the .txt extension?
  4. Have you made any changes to the Handler Mappings for the site? e.g. mapped the .htm extension to say the ASP ISAPI filter and accidentally removed the StaticFile handler?
  5. Can you serve other static content such as .jpg, .gif, .pdf etc?
Sign up to request clarification or add additional context in comments.

Comments

2

Kev has covered most of the possible problems, but for reference there is another possibility.

Confirm that in Request Filtering you either

  • have .txt as an Allowed extension, or
  • have 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>

Comments

1

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.

Comments

1

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:

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/index?view=aspnetcore-2.2&tabs=windows#web-root

1 Comment

I have two IIS servers. I put it in the root application directory on one server and it worked fine. Then on the other server it did not work which is inexplicable because the second machine is a clone of the first. The solution was to use wwwroot directory.
0

Add the MIME-Typ by going to ...

  1. features / Mime-type
  2. right click,
  3. add,
  4. put in the file extension ".txt"
  5. and the mime-type "text/plain"
  6. ok

et voila

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.