Web,ASP中的WebConfig文件错误 [英] WebConfig file error in asp,net

查看:82
本文介绍了Web,ASP中的WebConfig文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:每个配置节只能出现一次.
请帮我解决这个错误!

代码:


Error: Sections must only appear once per config .
pls help me out on this error!

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\v2.x\Config
-->
<configuration>
    <appSettings>
        <add key="DataProvider" value="System.Data.SqlClient"/>
        <add key="ConnectionString" value="Data Source=10.10.10.144;Initial Catalog=clientbackup;User ID=sa;Password='supp0rt';Pooling=False"/>
        <add key="CuteWebUI.AjaxUploader.UploadSpeedKB" value="100"/>
        <add key="CuteWebUI.AjaxUploader.TempDirectory" value="C:\\"/>
    </appSettings>
    <connectionStrings>
        <add name="ConnectionString" connectionString="Data Source=10.10.10.144;Initial Catalog=clientbackup;User ID=sa;Pooling=False" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
        <pages enableEventValidation="false">
            <controls>
                <add namespace="CuteWebUI" assembly="CuteWebUI.AjaxUploader" tagPrefix="CuteWebUI"/>
            </controls>
        </pages>
        <httpModules>
            <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>
        </httpModules>
        <!--
            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">
            <assemblies>
                <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            </assemblies>
        </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>
        -->
    </system.web>
</configuration>

推荐答案

出现此错误,如果该网站未在IIS中标记为Web应用程序.为此->转到IIS->右键单击您的项目,然后单击属性->单击删除.

如果同一文件夹中存在2个web.config文件.

如果存在2个web.config文件,请删除一个.
This error appears, If the website is not marked as web application in IIS. for this -> Go to IIS ->Right click your project, Properties ->Click on remove.

If 2 web.config files are present in the same folder.

Please remove one if 2 web.config files are present.


该错误不言自明.您不能在web.config文件中两次定义一个节.
删除行:
The error is self explanatory. You cannot have one section defined twice in a web.config file.
Remove the line:
<add key="ConnectionString" value="Data Source=10.10.10.144;Initial Catalog=clientbackup;User ID=sa;Password='supp0rt';Pooling=False"/>


来自

<appSettings> </appSettings>


部分.它应该工作. :thumbsup:

* edit-添加了说明.


section. It should work. :thumbsup:

*edit - added explanation.


这篇关于Web,ASP中的WebConfig文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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