ASP.NET:配置错误(“/”应用程序中的服务器错误。)
ASP.NET : Configuration Error(Server Error in '/' Application.)
这个错误让我抓狂!我正在处理我的 registration.aspx
页面,突然出现这个错误,我花了几天时间解决它,但没有任何效果!最后我删除了我的 registration.aspx
只是为了检查项目是否仍然在没有它的情况下工作但没有任何改变!
错误在第 15 行显示为红色:
> Server Error in '/' Application.
>
> Configuration Error
>
> Description: An error occurred during the processing of a
> configuration file required to service this request. Please review the
> specific error details below and modify your configuration file
> appropriately.
>
> Parser Error Message: Unrecognized element 'authentication'.
>
> Source Error:
>
>
> Line 13: <system.web>
> Line 14: <pages validateRequest="false">
> Line 15: <authentication mode="None"/>
> Line 16: <compilation debug="true" targetFramework="4.5"/>
> Line 17: <httpRuntime targetFramework="4.5"/>
web.config
页面:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="MyDatabase" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\user\Desktop\MyWebsite\MyWebsite\MyWebsite\App_Data\MyDatabase.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<pages validateRequest="false">
<authentication mode="None"/>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<namespaces>
<add namespace="System.Web.Optimization"/>
<add namespace="Microsoft.AspNet.Identity"/>
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
</controls>
</pages>
<membership>
<providers>
<!--
ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear/>
</providers>
</membership>
<profile>
<providers>
<!--
ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear/>
</providers>
</profile>
<roleManager>
<!--
ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<providers>
<clear/>
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
</providers>
</sessionState>
<compilation debug="true"/>
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication"/>
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<appSettings>
<!-- Beta configuration -->
<add key="STSHost" value="auth.beta.agiv.be"/>
<!-- See documentation https://auth.beta.agiv.be/framework/Documentation/index.html for a list of consumable services and their realms -->
<add key="STSRealm" value="urn:agiv.be/salvador"/>
<add key="ApplicationRealm" value="%Application realm%"/>
<!-- Production Configuration, uncomment for use -->
<!--
<add key="STSHost" value="auth.agiv.be"/>
<add key="STSRealm" value="urn:agiv.be/sts"/>
<add key="ApplicationRealm" value="%Application realm%"/>
-->
</appSettings>
<system.serviceModel>
<client/>
<behaviors>
<endpointBehaviors>
<behavior name="CertificateEndpointBehavior">
<clientCredentials>
<!-- Change this value to your certificate, and put this behavior on your client endpoint-->
<clientCertificate findValue="%Certificate Subject Distinguished Name%" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectDistinguishedName"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
请帮忙?
检查应用程序池,您似乎将其置于集成模式而不是经典模式。
<authentication>
不是 <pages>
的子级,它应该嵌套在 <system.web>
中
compilation
和httpRuntime
也需要移出
试试这个
<authentication mode="None"/>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Web.Optimization"/>
<add namespace="Microsoft.AspNet.Identity"/>
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
</controls>
</pages>
您还有两个 compilation
属性。删除第二个。
该错误告诉您它无法识别 <pages>
下的 <authentication>
元素。那是因为<authentication>
需要直接在<system.web>
.
下
<configuration>
<system.web>
<authentication mode="None" /> <!-- This is the line that needed to be moved -->
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Web.Optimization"/>
<add namespace="Microsoft.AspNet.Identity"/>
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
</controls>
</pages>
</system.web>
</configuration>
请务必注意错误消息,check the documentation 出现此类错误时。
这个错误让我抓狂!我正在处理我的 registration.aspx
页面,突然出现这个错误,我花了几天时间解决它,但没有任何效果!最后我删除了我的 registration.aspx
只是为了检查项目是否仍然在没有它的情况下工作但没有任何改变!
错误在第 15 行显示为红色:
> Server Error in '/' Application.
>
> Configuration Error
>
> Description: An error occurred during the processing of a
> configuration file required to service this request. Please review the
> specific error details below and modify your configuration file
> appropriately.
>
> Parser Error Message: Unrecognized element 'authentication'.
>
> Source Error:
>
>
> Line 13: <system.web>
> Line 14: <pages validateRequest="false">
> Line 15: <authentication mode="None"/>
> Line 16: <compilation debug="true" targetFramework="4.5"/>
> Line 17: <httpRuntime targetFramework="4.5"/>
web.config
页面:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="MyDatabase" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\user\Desktop\MyWebsite\MyWebsite\MyWebsite\App_Data\MyDatabase.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<pages validateRequest="false">
<authentication mode="None"/>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<namespaces>
<add namespace="System.Web.Optimization"/>
<add namespace="Microsoft.AspNet.Identity"/>
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
</controls>
</pages>
<membership>
<providers>
<!--
ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear/>
</providers>
</membership>
<profile>
<providers>
<!--
ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<clear/>
</providers>
</profile>
<roleManager>
<!--
ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
-->
<providers>
<clear/>
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
</providers>
</sessionState>
<compilation debug="true"/>
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication"/>
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<appSettings>
<!-- Beta configuration -->
<add key="STSHost" value="auth.beta.agiv.be"/>
<!-- See documentation https://auth.beta.agiv.be/framework/Documentation/index.html for a list of consumable services and their realms -->
<add key="STSRealm" value="urn:agiv.be/salvador"/>
<add key="ApplicationRealm" value="%Application realm%"/>
<!-- Production Configuration, uncomment for use -->
<!--
<add key="STSHost" value="auth.agiv.be"/>
<add key="STSRealm" value="urn:agiv.be/sts"/>
<add key="ApplicationRealm" value="%Application realm%"/>
-->
</appSettings>
<system.serviceModel>
<client/>
<behaviors>
<endpointBehaviors>
<behavior name="CertificateEndpointBehavior">
<clientCredentials>
<!-- Change this value to your certificate, and put this behavior on your client endpoint-->
<clientCertificate findValue="%Certificate Subject Distinguished Name%" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectDistinguishedName"/>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
请帮忙?
检查应用程序池,您似乎将其置于集成模式而不是经典模式。
<authentication>
不是 <pages>
的子级,它应该嵌套在 <system.web>
compilation
和httpRuntime
也需要移出
试试这个
<authentication mode="None"/>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Web.Optimization"/>
<add namespace="Microsoft.AspNet.Identity"/>
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
</controls>
</pages>
您还有两个 compilation
属性。删除第二个。
该错误告诉您它无法识别 <pages>
下的 <authentication>
元素。那是因为<authentication>
需要直接在<system.web>
.
<configuration>
<system.web>
<authentication mode="None" /> <!-- This is the line that needed to be moved -->
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<pages validateRequest="false">
<namespaces>
<add namespace="System.Web.Optimization"/>
<add namespace="Microsoft.AspNet.Identity"/>
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
</controls>
</pages>
</system.web>
</configuration>
请务必注意错误消息,check the documentation 出现此类错误时。