iis 找不到system.webServer的system.web.compilation.tempDirectory的对等项

vjhs03f7  于 2022-11-12  发布在  其他
关注(0)|答案(1)|浏览(170)

web.config中,system.webcompilation[tempDirectory]属性的等效属性是什么,但使用的是更新的system.webServer而不是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>
sczxawaw

sczxawaw1#

compilation[tempDirectory]依赖于system.web,因此不能将其添加到system.webServer中。
但是system.websystem.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>

相关问题