找不到等效的system.web.compilation.tempdirectory for system.webserver

发布于 2025-02-07 20:00:19 字数 1395 浏览 2 评论 0 原文

web.config 中,等于 system.web > compilation [tempdirectory] ​​属性,但使用更及最新的 > system.weberver 而不是 system.web

这是我需要添加到我的web.config的内容:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation tempDirectory="W:\vhosts\mysite.com\tmp" />
  </system.web>
</configuration>

但是,我当前的 web.config 依赖于 system.webserver ,而不是 system.web 并添加属性导致内部服务器错误500。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
    <rewrite>
      <rules>
        <rule name="Angular Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="./index.html" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

In web.config, what is the equivalent of system.web>compilation[tempDirectory] attribute but using the more up to date system.webServer instead of system.web?

Here is what I need to add to my web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation tempDirectory="W:\vhosts\mysite.com\tmp" />
  </system.web>
</configuration>

However, my current web.config relies on system.webServer, not system.web and adding the attribute results in an internal server error 500.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
    <rewrite>
      <rules>
        <rule name="Angular Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="./index.html" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北笙凉宸 2025-02-14 20:00:19

编译[tempDirectory] ​​取决于 system.web ,因此您不能在 system.webserver 中添加它。

但是 system.web system.webserver 都可以在web.config中存在。他们不会导致冲突。

<?xml version="1.0" encoding="utf-8"?>
<configuration>

 <system.web>
<compilation tempDirectory="W:\vhosts\mysite.com\tmp" />
</system.web>

<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
<rewrite>
  <rules>
    <rule name="Angular Routes" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="./index.html" />
    </rule>
  </rules>
</rewrite>
</system.webServer>
</configuration>

compilation[tempDirectory] is depending on system.web, so you cannot add it in system.webServer.

But system.web and system.webServer can both exist in web.config. They won't lead to conflict.

<?xml version="1.0" encoding="utf-8"?>
<configuration>

 <system.web>
<compilation tempDirectory="W:\vhosts\mysite.com\tmp" />
</system.web>

<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
<rewrite>
  <rules>
    <rule name="Angular Routes" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="./index.html" />
    </rule>
  </rules>
</rewrite>
</system.webServer>
</configuration>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文