每个配置文件错误只能出现一次 [英] Sections must only appear once per config file error

查看:50
本文介绍了每个配置文件错误只能出现一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的web.config文件包含以下代码

My web.config file includes the following code

<?xml version="1.0"?>
       <!--
       Note: As an alternative to hand editing this file you can use the 
       web admin tool to configure settings for your application. Use
       the Website->Asp.Net Configuration option in Visual Studio.
       A full list of settings and comments can be found in 
       machine.config.comments usually located in 
      \Windows\Microsoft.Net\Framework\vx.x\Config   
       -->
    <configuration>
	<appSettings/>
	<connectionStrings>
	<add name="MyConnectionString" connectionString="DataSource=MRUNEMO\SQLEXPRESS;Initial Catalog=InventoryManagement;Integrated Security=True"/>
	<add name="InventoryManagementConnectionString" connectionString="Data Source=MRUNEMO\SQLEXPRESS;Initial Catalog=InventoryManagement;Integrated Security=True" providerName="System.Data.SqlClient"/>
	</connectionStrings>
	<system.web>
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
		<compilation debug="true" targetFramework="4.0">
		</compilation>
		<!--
          The <authentication> section enables configuration 
          of the security authentication mode used by 
          ASP.NET to identify an incoming user. 
        -->
		<authentication mode="Windows"/>
		<!--
           The <customErrors> section enables configuration 
           of what to do if/when an unhandled error occurs 
           during the execution of a request. Specifically, 
           it enables developers to configure html error pages 
           to be displayed in place of a error stack trace.

                                                                                        <customErrors mode="RemoteOnly"defaultRedirect="GenericErrorPage.htm">
             <error statusCode="403" redirect="NoAccess.htm" />
             <error statusCode="404" redirect="FileNotFound.htm" />
           </customErrors>
        -->
    <authentication mode="Forms">

      <forms defaultUrl="Login.aspx" loginUrl="~/Login1.aspx" slidingExpiration="true" timeout="20"></forms>
    </authentication>

    <authorization>

    </authorization>
		<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
	<!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
</configuration>





我尝试过:



我知道我有2<身份验证模式>标签。

我实际上尝试使用asp.net中的会话登录注销代码

因为我需要< authentication mode =Forms>标签



但由于< authentication mode =Windows>标签我有错误。

我可以删除< authentication mode =Windows> ?

它会影响我的工作吗?



What I have tried:

I have understood that i have 2 <authentication mode> tags.
I am actually trying out a login logout code with sessions in asp.net
for that i need the <authentication mode="Forms"> tag

But due to <authentication mode="Windows"> tag i am having error.
Can i just delete the <authentication mode="Windows"> ?
Will it affect my working?

推荐答案

你只能拥有< authentication />在顶级web.config上。如果您计划实施登录/注销机制,可以删除< authentication mode =Windows>
You can only have <authentication /> on the top-level web.config. If you planning to implement your login/logout mechanism you can remove <authentication mode="Windows">


这篇关于每个配置文件错误只能出现一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆