【问题标题】:VS 2017 MVC error Server Error in '/' ApplicationVS 2017 MVC 错误“/”应用程序中的服务器错误
【发布时间】:2021-12-26 03:45:09
【问题描述】:

我试图向我的项目添加身份并收到此错误

“/”应用程序中的服务器错误。

配置错误说明:在安装过程中发生错误 处理服务此请求所需的配置文件。 请查看下面的具体错误详细信息并修改您的 配置文件。

解析器错误消息:使用注册为的部分是错误的 allowDefinition='MachineToApplication' 超出应用程序级别。这 错误可能是由于未将虚拟目录配置为 IIS 中的应用程序。

来源错误:

Line 41:   <system.web>
Line 42:       
Line 43:     <authentication mode="Forms">
Line 44:       <forms name="mycms" loginUrl="/Account/login"
Line 45:           protection="All" path="/" timeout="43200" />

这是我的网络配置

<?xml version="1.0"?>

<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="YoubaanCoaching" />
        
      </namespaces>
    </pages>
  </system.web.webPages.razor>



  <appSettings>
    <add key="webpages:Enabled" value="false" />
    <add key="owin:AutomaticAppStartup" value="false"/>
    <add key="owin:AppStartup" value="false"></add>
  </appSettings>

  <system.webServer>
    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>

  <system.web>
      
    <authentication mode="Forms">
      <forms name="mycms" loginUrl="/Account/login"
          protection="All" path="/" timeout="43200" />
    </authentication>
    <compilation>
      <assemblies>
        <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
  </system.web>
</configuration>

【问题讨论】:

    标签: c# asp.net asp.net-mvc


    【解决方案1】:

    我认为 URL 的末尾必须有斜杠(/)。 试试这个

    <authentication mode="Forms">
          <forms name="mycms" loginUrl="/Account/login/"
              protection="All" path="/" timeout="43200" />
        </authentication>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-18
      • 1970-01-01
      • 2019-05-07
      • 2015-10-09
      • 1970-01-01
      • 1970-01-01
      • 2020-10-18
      • 1970-01-01
      相关资源
      最近更新 更多