Error loading model locally on .net

I want to load the model locally. The model file is transferred to https://extract.autodesk.io. , it can be run on node.js, but failed to load on .net. The address of the file is not wrong, could you tell me what"s going on? "`

    var initOptions = {
        path: "r8/0.svf",
        env: ""
    }
    function onEnvInitialized() {

        var domContainer = document.getElementById("viewer")
        var viewer = new Autodesk.Viewing.Private.GuiViewer3D(domContainer)
        var result = viewer.start()
        var core = viewer.loadModel(initOptions.path)
    }
    Autodesk.Viewing.Initializer(
        initOptions,
        function () {
            onEnvInitialized()
        })`
      


found the reason. Because the server cannot parse the SVF format. So set up MIME Type. Add the following MIME types to the .NET Web.config file

<system.webServer>
    <staticContent>
      <mimeMap fileExtension=".svf" mimeType="application/octet-stream "/>
      <mimeMap fileExtension=".pf" mimeType="application/octet-stream "/>
      <mimeMap fileExtension=".pack" mimeType="application/octet-stream "/>
    </staticContent>

  </system.webServer>

in .NET Core, the MIME type must be added within the Configure method in the Startup.cs file. And because. Net core does not browse static files from the default path. So you must specify a static file directory and put the SVF file in that directory before the server can access it.

  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }
            app.UseAuthentication();
            app.UseHttpsRedirection();
            app.UseCookiePolicy();
            
            app.UseStaticFiles();
            
            var provider = new FileExtensionContentTypeProvider();
            provider.Mappings[".svf"] = "application/octet-stream";
            provider.Mappings[".pf"] = "application/octet-stream";
            provider.Mappings[".pack"] = "application/octet-stream";
            app.UseStaticFiles(new StaticFileOptions {
                ContentTypeProvider = provider,
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(env.ContentRootPath, @"MyStaticFiles")),
                RequestPath = new PathString("/StaticFiles")
            });

         
        }
Menu