0

I am trying to get my IIS server to treat .log files in a directory the same as it does a .txt file.

The .txt and .info files are displayed as text in a web page (which is what I want to acheive).

The .log file only wants to be "downloaded" or saved.

I have mime types configured like this in the webpage.conf file.

Everything works except the .log file extension.

The "remove" in line 2 here also seems to have no effect. I didn't have that at first, then added it in case there was some previous mapping affecting it.


    <staticContent>
    <remove fileExtension=".log" />
    <mimeMap fileExtension=".in" mimeType="text/html" />
    <mimeMap fileExtension=".log" mimeType="text/plain" />
        <mimeMap fileExtension=".bob" mimeType="text/plain" />
    <mimeMap fileExtension=".info" mimeType="text/html" />
    <mimeMap fileExtension=".index" mimeType="text/html" />
        <mimeMap fileExtension=".config" mimeType="text/html" />
    <mimeMap fileExtension="*" mimeType="application/octet-stream" />
    </staticContent>

All other tagged files present as text/html, unless they are not one of these extensions and are offered for download.

Server is Windows R12

Have tried editing the MIME type in the Web GUI, directly in the .conf file. No improvements.

3
  • Cannot reproduce what you described. You might change to another browser or use a tool like Wireshark to carefully analyze the HTTP responses. Commented Feb 28, 2024 at 17:17
  • May I know if you have got any chance to check my reply? Please feel free to share any progress on this issue to us and it will be very helpful for us to better work out this issue. Commented Mar 6, 2024 at 9:21
  • Thanks for your suggestions. After other investigations, I have had to switch to using Apache instead of IIS and it is working as expected. Commented Mar 8, 2024 at 11:47

1 Answer 1

0

I did a basic test and added the mime type <mimeMap fileExtension=".log" mimeType="text/plain" /> in the web.config file in the root directory of the website,

enter image description here

then my IIS web server to serve a ".log" file as text and not instead offer me a save/download.

enter image description here

I suggest you delete the configuration information and reconfigure it, and clear the browser cache.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this suggestion. I had edited the MIME types, which didn't help, though I had expected it to. I didn't try complete cache clearing. I have for other technical reasons on the project had to move to Apache server, which is working as needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.