asp.netweb-configmime-typeshttp-status-code-406

406.0 after adding mimetype to web.config


I am trying to get 3d models on my webpage, and found this pretty nice website and tutorial, however intigrating it in my own website is causing some problems.

Tutorial: https://doc.x3dom.org/tutorials/models/inline/index.html

At first copying this example code to my own page gave me a 404.3 because .x3d files are not supported by IIS.

<x3d width='500px' height='400px'> 
  <scene>
    <inline nameSpaceName="Deer" mapDEFToID="true" onclick='redNose();' url="Deer.x3d" >  </inline>
  </scene> 
</x3d> 

Since .x3d files are basically XML. I added the following lines to my web.config

<staticContent>
  <remove fileExtension=".x3d" />
  <mimeMap fileExtension=".x3d" mimeType="text/xml" />
</staticContent>

And with these lines looking up the file does no longer give a 404, however now it gives a generic 406.0 unaccepted. Furthermore according to the Network tab on the chrome dev tools it says the Type is xhr and not xml.


Solution

  • The web.config required the following Mimetype model/x3d+xml

    <staticContent>
      <remove fileExtension=".x3d" />
      <mimeMap fileExtension=".x3d" mimeType="model/x3d+xml" />
    </staticContent>
    

    So anyone encountering a similar problem, google the file type and its required mimetype