【问题标题】:IIS express and IIS7 pathIIS express 和 IIS7 路径
【发布时间】:2020-02-07 21:00:39
【问题描述】:

我是专家, 我需要在 IIS7 中运行的 Web 程序上更新一些 dll。我在我的 PC 上使用 Visual Studio 和 IIS express 准备了所有工作,所有更改都运行良好。所以我做了一个本地文件系统部署并将内容复制到运行 IIS7 的生产服务器。 某些字体、字形无法正确显示。在网络选项卡中,我可以看到所有未加载的文件都有 301 永久重定向,然后找不到 404。我仔细检查了文件存在的服务器目录。

我唯一能看到的是路径不一样。例如,在 IIS Express 上: http://localhost:49193/Content/kendo/fonts/glyphs/WebComponentsIcons.ttf?gedxeo 然后在生产现场 http://ProductionSite.com/Content/fonts/glyphs/WebComponentsIcons.ttf?gedxeo

文件的来源在 css 中,如下所示:src:url(fonts/glyphs/WebComponentsIcons.eot?gedxeo)

有什么想法吗?

更新1 哑剧定义:

<dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <!-- Compress XML files -->
        <add mimeType="application/xml" enabled="true" />
        <!-- Compress JavaScript files -->
        <add mimeType="application/javascript" enabled="true" />
        <!-- Compress JSON files -->
        <add mimeType="application/json" enabled="true" />
        <!-- Compress SVG files -->
        <add mimeType="image/svg+xml" enabled="true" />
        <!-- Compress RSS feeds -->
        <add mimeType="application/rss+xml" enabled="true" />
        <!-- Compress Atom feeds -->
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <!-- Compress ICO icon files (Note that most .ico files are uncompressed but there are some that can contain PNG compressed images. If you are doing this, remove this line). -->
        <add mimeType="image/x-icon" enabled="true" />
        <!-- Compress XML files -->
        <add mimeType="application/xml" enabled="true" />
        <add mimeType="application/xml; charset=UTF-8" enabled="true" />
        <!-- Compress JavaScript files -->
        <add mimeType="application/javascript" enabled="true" />
        <!-- Compress JSON files -->
        <add mimeType="application/json" enabled="true" />
        <!-- Compress SVG files -->
        <add mimeType="image/svg+xml" enabled="true" />
        <!-- Compress EOT font files -->
        <add mimeType="application/vnd.ms-fontobject" enabled="true" />
        <!-- Compress TTF font files - application/font-ttf will probably be the new correct MIME type. IIS still uses application/x-font-ttf. -->
        <!--<add mimeType="application/font-ttf" enabled="true" />-->
        <add mimeType="application/x-font-ttf" enabled="true" />
        <!-- Compress OTF font files - application/font-opentype will probably be the new correct MIME type. IIS still uses font/otf. -->
        <!--<add mimeType="application/font-opentype" enabled="true" />-->
        <add mimeType="font/otf" enabled="true" />
        <!-- Compress RSS feeds -->
        <add mimeType="application/rss+xml" enabled="true" />
        <add mimeType="application/rss+xml; charset=UTF-8" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>

c

【问题讨论】:

  • 尝试运行失败的请求跟踪并检查实际问题link。此路径是否在您的站点文件夹下?如果 Kendo UI 样式的 StyleBundle 的虚拟目录的根目录与物理目录不同,则可能会出现此类问题。这使得用于引用字体的相对路径不正确。
  • 如果您为类似这样的 Kendo UI 样式定义单独的 StyleBundle,您应该能够解决此类问题(请注意,您可能需要修改路径以完全匹配您的文件夹结构):bundles.Add(new StyleBundle("~/Content/kendo/2017.2.504/css").Include( "~/Content/kendo/2017.2.504/kendo.common.min.css", "~/Content/kendo/2017.2.504/kendo.default.min.css")); .参考link
  • 经过多次测试。目前解决我的问题的唯一方法是设置:BundleTable.EnableOptimizations = false;在我项目的 bunble 配置中。
  • 我请求您可以将解决方案发布为答案并标记它。它将帮助面临类似问题的其他人。

标签: iis-7 iis-7.5


【解决方案1】:

检查 Mime 类型。生产服务器上的字体可能没有添加 MIME 类型。

【讨论】:

    【解决方案2】:

    我不明白为什么。我的客户使用非常旧的 IIS 7.5 服务器... 现在解决我的问题的唯一方法是添加: BundleTable.EnableOptimizations = false 进入 bundle.config 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-14
      • 2019-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多