簡體   English   中英

與web.config有關的錯誤

[英]Error conerned with web.config

以下是執行時出現的錯誤。

“ /”應用程序中的服務器錯誤。

配置錯誤描述:處理服務於此請求所需的配置文件時發生錯誤。 請查看下面的特定錯誤詳細信息,並適當修改您的配置文件。

解析器錯誤消息:使用超出應用程序級別注冊為allowDefinition ='MachineToApplication'的節是錯誤的。 此錯誤可能是由於未在IIS中將虛擬目錄配置為應用程序引起的。

源錯誤:

Line 22:     <customErrors mode="RemoteOnly"/>
Line 23:    
Line 24:     <authentication mode="Forms">
Line 25:       <forms loginUrl="Default.aspx" protection="Validation" timeout="300" />
Line 26:     </authentication>

源文件:D:\\ slnAllForKids \\ slnAllForKids \\ Allforkids \\ allforkids \\ web.config行:24

以下是我的web.config

<?xml version="1.0"?><configuration>
  <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <add name="AllForKidsConnectionString" connectionString="Data Source=GRAPHIX\SQLEXPRESS;Initial Catalog=AllForKidsData;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>


    <customErrors mode="RemoteOnly"/>

    <authentication mode="Forms">
      <forms loginUrl="Default.aspx" protection="Validation" timeout="300"/>
    </authentication>
    <authorization>
      <allow users="*"/>
    </authorization>


        <compilation  debug="false">
            <assemblies>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation></system.web>
  <system.web>
    <pages styleSheetTheme="Kids1">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>
    </pages>
    <!--
          Set compilation debug="true" to insert debugging
          symbols into the compiled page. Because this
          affects performance, set this value to true only
          during development.
    -->


    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>

    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </httpModules>
  </system.web>


  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </handlers>
  </system.webServer>
</configuration>

我必須進行哪些更正才能更正此錯誤

這與IIS中的應用程序安裝有關

您需要將虛擬目錄標記為“應用程序”。

對於IIS 6

  • 右鍵單擊包含您的應用程序的虛擬目錄,
  • 去屬性
  • 轉到虛擬目錄選項卡
  • 應用程序設置部分
  • 單擊“創建”默認應用程序

我知道這已經很老了,但是只是在有人遇到類似問題時提供提示。 出乎意料的是,更新之后(使用手動ftp進行服務器更新而不是webdeploy),我的應用程序遇到了此錯誤。 我正在開發MVC Web應用程序。 幾個小時后,我意識到我將主Web.config文件錯誤地放在了views文件夾中。 用正確的視圖文件夾配置文件替換該文件可以解決此問題。

您是否在IIS中為您的站點創建了虛擬應用程序?

我認為提示是在錯誤消息中:

“此錯誤可能是由於未在IIS中將虛擬目錄配置為應用程序引起的。”

您需要將虛擬目錄配置為IIS中的應用程序。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM