Skip to content

Adding mime types produces 404 #732

Open
@codehippie1

Description

I have been trying to get mime maps working on this repository.

Every http request to unknown mime types (On IIS Express and Azure web apps) results in 404 error.

Steps.

  1. Clone/Download repo.
  2. Add an empty text file under wwwroot/assets. Rename it as sample.properties
  3. Add another empty file under same directory. Name it sample.json
  4. Request both files via browser. sample.json produces no error
  5. Requesting sample.properties produces 404 (GET http://localhost:63554/assets/sample.properties 404 (Not Found))

What did I try.

  1. Added mime map on web.config of aspnet core project
  2. Added runAllManagedModulesForAllRequests to web.config
  3. Executed appcmd set config /section:staticContent /+[fileExtension='properties',mimeType='application/octet-stream'] from IIS Express folder(C:\Program Files(x86)\IIS Express) in command line(as admin)

Here is full web.config

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
      <environmentVariables />
    </aspNetCore>
    <staticContent>
      <remove fileExtension=".properties" />
      <mimeMap fileExtension=".properties" mimeType="application/octet-stream" />
      <remove fileExtension=".txtabcd" />
      <mimeMap fileExtension=".txtabcd" mimeType="application/text" />
    </staticContent>
  </system.webServer>

Interestingly enough, deploying this to an azure app service still produces this error.
@MarkPieszak Have you encountered a similar error on unusual mime types before?

PS: Default VS 2017 angular template works without adding mimemap for properties file.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions