编辑web.config文件后出现HTTP错误500

3
在web.config(ASP.NET 4)中添加<location>标签后,我遇到了HTTP 500 Internal Server Error错误, 当我移除<location>标签时,它可以正常工作。
<?xml version="1.0"?>

<configuration>

  <location path="man">
    <system.web>
      <authorization>
        <allow users="man"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>

    <configSections>
      <section name="rewriter"
               requirePermission="false"
               type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
    </configSections>

    <system.web>
        <compilation debug="true" targetFramework="4.0" />

        <authentication mode="Forms">
          <forms    name=".ASPXAUTH"
                  loginUrl="Login.aspx"
                  protection="All"
                  timeout="30"
                  path="/"
                  requireSSL="false"
                  slidingExpiration="true"
                  defaultUrl="Login.aspx"
                  cookieless="UseCookies"
                  enableCrossAppRedirects="false"/>
        </authentication>

        <httpModules>
          <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
        </httpModules>

    </system.web>

  <system.webServer>

    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
    </modules>

    <validation validateIntegratedModeConfiguration="false" />

  </system.webServer>

  <rewriter>
    <rewrite url="~/man/(.+)" to="~/man/$1" processing="stop" />
    <rewrite url="~/man/^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.axd)(\?.+)?)$" to="~/man/$1" processing="stop" />
    <rewrite url="~/files/^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.axd|\.pdf|\.doc|\.ppt)(\?.+)?)$" to="~/files/$1" processing="stop" />
    <rewrite url="~/man/" to="~/man/default.aspx" processing="stop"/>
    <rewrite url="~/style/(.+)" to="~/style/$1" processing="stop" />
    <rewrite url="~/images/(.+)" to="~/images/$1" processing="stop" />
    <rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.axd)(\?.+)?)$" to="$1" processing="stop" />
    <rewrite url="~/(.+)" to="~/default.aspx?pn=$1" />
  </rewriter>

</configuration>
1个回答

4

位置必须放在configSections之下。


谢谢!这里没有提到它的任何内容 http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx - Maysam

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接