我使用这个插件:PDF.js。
我正在尝试解决控制台日志中显示的问题。
如下所示:

Here是一个准备好的简单项目,只有下载并运行项目才会看到同样的问题。我试过了所有的方法,但我不能解决一个问题。
关注html:
<div style="width: 800px; height: 500px;">
<iframe width="800" height="500" id="iframePdfViewer" seamless="seamless" scrolling="no" src="~/Scripts/pdfjs-dist/web/viewer.html"></iframe>
</div>查看包含"locale.properties“文件的另一个图像:

我也收到了很多来自l10n.js的警告。我在这里下载了它:http://mozilla.github.io/pdf.js/,点击“下载”按钮。
有什么解决方案吗?
发布于 2018-08-02 15:45:08
在web.config文件中添加.properties MIME类型配置应该是有效的:
<configuration>
<!-- other stuff -->
<system.webServer>
<staticContent>
<mimeMap fileExtension=".properties" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>如果项目已经部署在IIS (不是IIS Express)中,请转到site name => MIME Types => Add,并将.properties扩展设置为application/octet-stream类型,如下图所示:

以下是所有l10n.js错误消失后的控制台日志视图:

使用application/octet-stream背后的原因是,相应的文件应该被视为流,即使文件内容是可读的并以文本格式存储。
发布于 2020-05-20 21:28:37
如果您正在使用.net核心(2.1),请尝试将.properties作为静态文件添加到"public void Configure(IApplicationBuilder app,IHostingEnvironment env)“方法中
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".properties"] = "application/octet-stream";
app.UseSpaStaticFiles(new StaticFileOptions
{
ContentTypeProvider = provider
});https://stackoverflow.com/questions/51634425
复制相似问题