简体   繁体   中英

IIS Express Not Serving Static Files Over Basic Authentication

I have a ASP.NET WEB API 2 application which was configured to use Windows Integrated Authentication and was working without an issue.

When I change the authentication mode to basic, none of the static files are served by IIS Express. Instead it returns 500. Rest of the files like aspx are getting served without an issue.

Any ideas why this might be happening?

I'm using Visual Studio 2013, but also tried it on Visual Studio 2015 and got the same result.

PS: Static files are getting served fine when deployed on a full IIS instance.

PS2: I've the following in my web.config:

<staticContent>
  <remove fileExtension=".woff2" />
  <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
  <clientCache cacheControlMode="DisableCache" />
</staticContent>

UPDATE: If I remove the

<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />

part, IIS Express serves all the static content except the .woff2 files, if I leave it in, it doesn't serve any static files.

Thanks in advance

After doing research, I figured out it was due to UAC.

Please refer to this for more information.

I had the exact same issue when trying to load babylon js files, I found the issue seems to be that ISS doesn't like being 'side loaded' with additional mime types.

Now to fix this, you could mess with the UAC for your computer, or you can add those mime types to your application host file under

%userprofile%\\documents\\iisExpress\\config\\applicationhost.config

I added mine to the top of the pile of mime types already in there:

<staticContent lockAttributes="isDocFooterFileName">
        <mimeMap fileExtension=".json" mimeType="application/text" />
        <mimeMap fileExtension=".dds" mimeType="application/dds" />
        <mimeMap fileExtension=".tga" mimeType="application/tga" />
        <mimeMap fileExtension=".fx" mimeType="application/fx" />
        <mimeMap fileExtension=".babylon" mimeType="application/babylon" />
        <mimeMap fileExtension=".babylonmeshdata" mimeType="application/babylonmeshdata" />
        <mimeMap fileExtension=".babylonbinarymeshdata" mimeType="application/babylonbinarymeshdata" />
        <mimeMap fileExtension=".cache" mimeType="text/cache-manifest" />
        <mimeMap fileExtension=".323" mimeType="text/h323" />
        .....

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM