【发布时间】:2020-11-06 16:42:55
【问题描述】:
我正在尝试在 IIS 上部署我的 mvc angular 应用程序,到目前为止一切正常。但是,现在我需要提供一些具有自定义扩展名的静态文件(例如 .dma)。为此,我为我的站点添加了适当的 MIME 类型配置,但它似乎不起作用。
二进制文件的一般结构如下:
.
+-- AngularApp
| +-- dist
| +-- assets
| +-- specialfile.dma
| +-- ...
+-- index.html
+-- wwwroot
| +-- icon.svg
+-- appsettings.json
+-- web.config
+-- *.dll
我的 web.config 看起来像这样。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\mywebapp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".dma" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
当我尝试从资产文件夹中获取扩展名为 .dma 的文件时,找不到该文件。 我已经检查过是否可以从同一个文件夹中检索任何其他文件(例如 png 图像),因此路由很好。
我还部署了独立于 MVC 应用程序的 Angular 应用程序,结果证明我可以获取该文件。
我在这里错过了什么?
我还需要添加其他配置吗?
【问题讨论】:
标签: asp.net-mvc iis