failed to load glTF model

Simply trying to show a glTF model in Cesium running locally:
1. .Net MVC app
2. running in IIS Express in VS
3. configured Documents\IISExpress\config\applicationhost.config with
      <remove fileExtension=".gltf" />
      <mimeMap fileExtension=".gltf" mimeType="model/gltf+json" />

Seems to get the file from the server but then Failed To Load.

Any thoughts would be appreciated...

1. A concise explanation of the problem you're experiencing.
"Failed to load model: ../../DataStore/Images/Cesium_Air.gltf"

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

viewer.entities.add({
                        name: data[i].CommonName,
                        position: position,
                        orientation: orientation,
                        billboard: {
                            image: '../DataStore/Images/MapPin.png',
                            width: 32,
                            height: 32
                        },
                        model: {
                            uri: '../../DataStore/Images/Cesium_Air.gltf',
                        },
                        polygon: {
                            hierarchy: Cesium.Cartesian3.fromDegreesArray(GetPlotCorners(data[i].lat, data[i].long)),
                            height: 0,
                            material: Cesium.Color.RED.withAlpha(0.5),
                            outline: true,
                            outlineColor: Cesium.Color.BLACK
                        },
                        testProperty: data[i].storeAddress,
                        gridType: 'store',
                        long: data[i].long,
                        lat: data[i].lat
                    });

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

want to show a gltf file at a position and prove that it can be done so I can build on this further

4. The Cesium version you're using, your operating system and browser.
Windoze 10
FireFox Version 56.0 (64-bit)
  var Cesium = {
    VERSION : '1.37'

Are there any errors in the console? Is the file being served gzipped? I don’t really know enough about IIS to guess what the issue is.

But the error occurs on or inside the initial loadArrayBuffer call. You might be able to track it down by stepping through that code in the console’s debugger.

loadArrayBuffer(url, options.headers).then(function(arrayBuffer) {

``

Hi Sean,
Thanks for taking a look. There's really not much in the console that looks related other than the "RuntimeError" failed to load the model. The model is not, that i'm aware of, being served zipped. I believe it's just sending the file: this is running locally for me through VS IIS Express. I'll post the exact console output as well as the stack from the failed to load below it, in case it helps.

CONSOLE:
Error: WebGL warning: texSubImage2D: Alpha-premult and y-flip are deprecated for non-DOM-Element uploads. Cesium.js:509:994
Object { name: "RuntimeError", message: "Failed to load model: ../../DataSto…", stack: "t@http://localhost:65303/Scripts/Ce…" } Cesium.js:528:25603
Error: WebGL warning: texSubImage2D: Texture has not been initialized prior to a partial upload, forcing the browser to clear it. This may be slow. Cesium.js:509:1092
Error: WebGL warning: texSubImage2D: This operation requires zeroing texture data. This is slow. Cesium.js:509:1092
Error: WebGL warning: texSubImage2D: Alpha-premult and y-flip are deprecated for non-DOM-Element uploads. Cesium.js:509:994
Error: WebGL warning: texImage2D: Alpha-premult and y-flip are deprecated for non-DOM-Element uploads.

THE LOAD ERROR:
Failed to load model: ../../DataStore/Images/Cesium_Air.gltf
RuntimeError
STACK:
"t@http://localhost:65303/Scripts/Cesium/Cesium.js:486:4061Re/<@http://localhost:65303/Scripts/Cesium/Cesium.js:527:9084o/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:27880h/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28347m@http://localhost:65303/Scripts/Cesium/Cesium.js:484:29731f@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28485n@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28009o/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:27880h/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28347m@http://localhost:65303/Scripts/Cesium/Cesium.js:484:29731f@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28485n@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28009g/<@http://localhost:65303/Scripts/Cesium/Cesium.js:485:3483o/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:27880h/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28347m@http://localhost:65303/Scripts/Cesium/Cesium.js:484:29731f@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28485n@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28009o/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:27880h/<@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28347m@http://localhost:65303/Scripts/Cesium/Cesium.js:484:29731f@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28485n@http://localhost:65303/Scripts/Cesium/Cesium.js:484:28009c.load/h.onload@http://localhost:65303/Scripts/Cesium/Cesium.js:489:3857"

I can try sending in the cesium.js from source instead of the minified/built version because it's difficult to step through it in that form.

cleaner version of trace:

onModelError http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:140078:9
  rejected/p< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5247:33
  _then/< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5327:5
  processQueue http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5677:4
  _resolve http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5363:4
  promiseReject http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5396:11
  getFailedLoadFunction/< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:136318:13
  rejected/p< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5247:33
  _then/< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5327:5
  processQueue http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5677:4
  _resolve http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5363:4
  promiseReject http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5396:11
  rejected/p< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5247:33
  _then/< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5327:5
  processQueue http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5677:4
  _resolve http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5363:4
  promiseReject http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5396:11
  getRequestFailedFunction/< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:6795:13
  rejected/p< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5247:33
  _then/< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5327:5
  processQueue http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5677:4
  _resolve http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5363:4
  promiseReject http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5396:11
  rejected/p< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5247:33
  _then/< http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5327:5
  processQueue http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5677:4
  _resolve http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5363:4
  promiseReject http://localhost:65303/Scripts/Cesium/Build/CesiumUnminified/Cesium.js:5396:11
  loadWithXhr.load/xhr.onload

Looks like it's never getting downloaded from the server:

<div class="content-container">
  <h3>HTTP Error 404.3 - Not Found</h3>
  <h4>The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.</h4>
</div>
<div class="content-container">
<fieldset><h4>Most likely causes:</h4>
  <ul> <li>It is possible that a handler mapping is missing. By default, the static file handler processes all content.</li> <li>The feature you are trying to use may not be installed.</li> <li>The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.)</li> <li>If ASP.NET is not installed.</li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Things you can try:</h4>
  <ul> <li>In system.webServer/handlers: <ul> <li>Ensure that the expected handler for the current page is mapped.</li> <li>Pay extra attention to preconditions (for example, runtimeVersion, pipelineMode, bitness) and compare them to the settings for your application pool.</li> <li>Pay extra attention to typographical errors in the expected handler line.</li> </ul> </li> <li>Please verify that the feature you are trying to use is installed.</li> <li> Verify that the MIME map is enabled or add the MIME map for the Web site using the command-line tool appcmd.exe. <ol> <li>To set a MIME type, run the following command in the IIS Express install directory: <b>appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string']</b></li> <li>The variable fileExtension string is the file name extension and the variable mimeType string is the file type description.</li> <li>For example, to add a MIME map for a file which has the extension ".xyz": <b>appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain']</b></li> </ol> Warning: Ensure that this MIME mapping is needed for your Web server before adding it to the list. Configuration files such as .CONFIG or dynamic scripting pages such as .ASP or .ASPX, should not be downloaded directly and should always be processed through a handler. Other files such as database files or those used to store configuration, like .XML or .MDF, are sometimes used to store configuration information. Determine if clients can download these file types before enabling them. </li> <li>Install ASP.NET.</li> <li>Check the failed request tracing logs for additional information about this error. For more information, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul>
</fieldset>
</div>

<h4>More Information:</h4>
  This error occurs when the file extension of the requested URL is for a MIME type that is not configured on the server. You can add a MIME type for the file extension for files that are not dynamic scripting pages, database, or configuration files. Process those file types using a handler. You should not allows direct downloads of dynamic scripting pages, database or configuration files.

Host
localhost:65303
User-Agent
Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/56.0
Accept
model/gltf-binary,model/gltf+j…ication/json;q=0.2,*/*;q=0.01
Accept-Language
en-US,en;q=0.5
Accept-Encoding
gzip, deflate
Referer
http://localhost:65303/Demo/Hello3DWorld
Cookie
__RequestVerificationToken=OnE…IcxbVx0GU89g4Ou0ey_iPuf-YGT9w
Connection
keep-alive

So server configuration now has:
        <httpCompression directory="%TEMP%\iisexpress\IIS Temporary Compressed Files">
            <scheme name="gzip" dll="%IIS_BIN%\gzip.dll" />
            <dynamicTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/javascript" enabled="true" />
                <add mimeType="application/atom+xml" enabled="true" />
                <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="model/gltf+json" enabled="true" />
                <add mimeType="*/*" enabled="true" />
            </dynamicTypes>
            <staticTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="image/svg+xml" enabled="true" />
                <add mimeType="application/javascript" enabled="true" />
                <add mimeType="application/atom+xml" enabled="true" />
                <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="model/gltf+json" enabled="true" />
                <add mimeType="*/*" enabled="true" />
            </staticTypes>
        </httpCompression>

<staticContent lockAttributes="isDocFooterFileName">
     <mimeMap fileExtension=".gltf" mimeType="model/gltf+json" />
</staticContent>

and

<urlCompression doDynamicCompression="true" />

Has anyone successfully served gltf file from IIS Express?

SOLUTION:

IIS Express operates from potentially different config files. So adding the gltf mime map .gltf to model/gltf+json wasn't working for the <user>/Documents/IIS Express/Config/applicationhost.config file. That's because it was reading configuration settings from the visual studio folder ".vs" folder. Find your configuration file in there and modify that.

Now models are coming in fine.

Hope this can help someone else.

Cool, I’m glad to hear its fixed now.

Hello, I also encountered the same problem, may I ask how to solve this

When I used it locally, I could load it according to the path, but when I deployed it to IIS, I showed the same problem as this friend