IIS7 和 MVC 2 出现 403.14 错误 已经尝试了所有建议的修复方法

发布于 2024-10-10 03:18:44 字数 4502 浏览 2 评论 0原文

ASP.Net 4 框架上的 MVC 2 项目。我尝试在 IIS7 上设置它,但出现 403.14 错误。

是的,我尝试了微软的修复,它启用了目录浏览,但与我想要的完全错误。

是的,我运行了 aspnet_regiis -i

不,它仍然不起作用

我也尝试重新安装 .net 4,但仍然没有任何效果。

我有点怀疑这可能是站点本身的问题,因为其他 .Net 项目将在同一个 IIS 上运行。我唯一能想到的是它是我的 .config 文件,我将其粘贴在下面:

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
  </configSections>
  <appSettings configSource="AppSettings.config"/>

  <connectionStrings configSource="ConnectionStrings.config" />
  <system.net>
    <mailSettings>
      <smtp configSource="Smtp.config" />
    </mailSettings>
  </system.net>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Security/AccessDenied" timeout="2880" />
    </authentication>
    <roleManager enabled="true" cacheRolesInCookie="false" defaultProvider="RoleProvider">
      <providers>
        <clear />
        <add name="RoleProvider" type="Boeing.Gls.Lpm.Web.Providers.LpmRoleProvider" />
      </providers>
    </roleManager>
    <customErrors mode="Off" defaultRedirect="Error.aspx">
      <error statusCode="404" redirect="Lpm/NotFound" />
    </customErrors>
    <pages>
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Boeing.Gls.Lpm.Web.Models" />
        <add namespace="Boeing.Gls.Lpm.Domain.DataContracts" />
      </namespaces>
    </pages>
    <httpRuntime requestValidationMode="2.0" />
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="false" />
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <log4net debug="false">
    <!-- Define some output appenders -->
    <appender name="trace" type="log4net.Appender.TraceAppender, log4net">
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
      </layout>
    </appender>
    <appender name="console" type="log4net.Appender.ConsoleAppender, log4net">
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] [BemsId : %property{bemsid}] %-5p %c - %m%n" />
      </layout>
    </appender>
    <appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net">
      <param name="File" value="App_Data/Log.txt" />
      <param name="AppendToFile" value="true" />
      <param name="RollingStyle" value="Date" />
      <param name="DatePattern" value="yyyy.MM.dd" />
      <param name="StaticLogFileName" value="true" />
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
      </layout>
    </appender>
    <logger name="NHibernate">
      <level value="ERROR" />
    </logger>
    <root>
      <priority value="DEBUG" />
      <appender-ref ref="rollingFile" />
    </root>
  </log4net>
</configuration>

有什么想法吗?

MVC 2 project on the ASP.Net 4 framework. I'm trying to set it up on IIS7 and it's giving me a 403.14 error.

Yes, I tried the microsoft fix, which is enabling directory browsing and is completely the wrong thing of what I want it to do.

Yes, I ran aspnet_regiis -i

No, it's still not working

I tried reinstalling .net 4 too, still nothing.

I have a slight suspicion that it may be something in the site itself as other .Net projects will run on the same IIS. Only thing I can think of is that it's my .config file, which I will paste below:

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
  </configSections>
  <appSettings configSource="AppSettings.config"/>

  <connectionStrings configSource="ConnectionStrings.config" />
  <system.net>
    <mailSettings>
      <smtp configSource="Smtp.config" />
    </mailSettings>
  </system.net>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Security/AccessDenied" timeout="2880" />
    </authentication>
    <roleManager enabled="true" cacheRolesInCookie="false" defaultProvider="RoleProvider">
      <providers>
        <clear />
        <add name="RoleProvider" type="Boeing.Gls.Lpm.Web.Providers.LpmRoleProvider" />
      </providers>
    </roleManager>
    <customErrors mode="Off" defaultRedirect="Error.aspx">
      <error statusCode="404" redirect="Lpm/NotFound" />
    </customErrors>
    <pages>
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Boeing.Gls.Lpm.Web.Models" />
        <add namespace="Boeing.Gls.Lpm.Domain.DataContracts" />
      </namespaces>
    </pages>
    <httpRuntime requestValidationMode="2.0" />
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="false" />
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <log4net debug="false">
    <!-- Define some output appenders -->
    <appender name="trace" type="log4net.Appender.TraceAppender, log4net">
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
      </layout>
    </appender>
    <appender name="console" type="log4net.Appender.ConsoleAppender, log4net">
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] [BemsId : %property{bemsid}] %-5p %c - %m%n" />
      </layout>
    </appender>
    <appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net">
      <param name="File" value="App_Data/Log.txt" />
      <param name="AppendToFile" value="true" />
      <param name="RollingStyle" value="Date" />
      <param name="DatePattern" value="yyyy.MM.dd" />
      <param name="StaticLogFileName" value="true" />
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
      </layout>
    </appender>
    <logger name="NHibernate">
      <level value="ERROR" />
    </logger>
    <root>
      <priority value="DEBUG" />
      <appender-ref ref="rollingFile" />
    </root>
  </log4net>
</configuration>

Any ideas?

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

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

发布评论

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

评论(1

2024-10-17 03:18:44

尝试设置 runAllManagedModulesForAllRequests="true"

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

Try setting runAllManagedModulesForAllRequests="true":

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文