[iModelJS] TypeError: Failed to fetch

测试示例为imodeljs-samples中的ninezone-sample-app,测试打开的文件为本地离线文件,

在.\ninezone-sample-app目录下,增加了assets\sample_documents文件夹,将.i.bim文件置于该目录下,

在.env.local中设置imjs_offline_imodel的值,imjs_offline_imodel="assets\\sample_documents\\***.i.bim",

本机上测试程序,run build正常,run start也正常,离线文件打开是没有问题的,

局域网内其他机器上打开,显示TypeError:Failed to fetch,利用Tomcat配置后执行也是同样的错误。

请问如何解决局域网内的同一本地文件访问呢?

Parents Reply
  • 您好,可否提供一下稍详细的解决方案呢?目前文件打开方式如下:

          try {
            // attempt to open the imodel
            if (true) {//this.props.offlineIModel
              const offlineIModel = Config.App.getString("imjs_offline_imodel");
              imodel = await SnapshotConnection.openFile(offlineIModel);
            } else {
              const info = await this.getIModelInfo();
              imodel = await RemoteBriefcaseConnection.open(info.projectId, info.imodelId, OpenMode.Readonly);
            }
          } catch (e) {
            alert(e.message);
          }

Children
No Data