如何解决每个配置文件中的节只能出现一次有关异常,请参见帮助主题<location>为什么?
| 配置错误 说明:在处理服务于此请求所需的配置文件期间发生错误。请查看下面的特定错误详细信息,并适当修改您的配置文件。<configuration>
<system.net>
<mailSettings>
<smtp from=\"makovetskiyd@yahoo.co.uk\">
<network host=\"smtp.gmail.com\" enableSsl=\"true\" defaultCredentials=\"false\" port=\"587\" userName=\"****\" password=\"****\"/>
</smtp>
</mailSettings>
</system.net>
<connectionStrings>
<clear/>
<add name=\"SqlState\" connectionString=\"Data Source=localhost;DataBase=AnyNameOfServerState;Integrated Security=True\" providerName=\"System.Data.SqlClient\"/>
<add name=\"YourGuruDB\" connectionString=\"Data Source=DIMA-00AA1DA557;Initial Catalog=model;Integrated Security=True\"/>
<add name=\"modelConnectionString\" connectionString=\"Data Source=.\\SQLEXPRESS;AttachDbFilename=\'D:\\Documents and Settings\\Dima\\My Documents\\Visual Studio 2010\\WebSites\\WebSite10\\App_Data\\ASPNETDB.MDF\';Integrated Security=True;User Instance=True;Trusted_Connection=Yes;\" providerName=\"System.Data.SqlClient\"/>
</connectionStrings>
<system.web>
<sessionState mode=\"SQLServer\" sqlConnectionString=\"SqlState\" allowCustomSqlDatabase=\"true\" cookieless=\"false\" timeout=\"20\"/>
<compilation debug=\"true\"/>
<authentication mode=\"Forms\">
<forms name=\".MyCookie\" loginUrl=\"~/Registration.aspx\" protection=\"All\" timeout=\"30\" path=\"/\">
<credentials passwordFormat=\"MD5\">
<user name=\"****\" password=\"****\"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users=\"?\"/>
<allow users=\"*\"/>
</authorization>
<roleManager enabled=\"true\" defaultProvider=\"MyRoleProvider\">
<providers>
<clear/>
<add name=\"MyRoleProvider\" applicationName=\"/\" connectionStringName=\"modelConnectionString\" type=\"System.Web.Security.SqlRoleProvider\"/>
</providers>
</roleManager>
<membership defaultProvider=\"MyMembershipProvider\">
<providers>
<clear/>
<add name=\"MyMembershipProvider\" type=\"System.Web.Security.SqlMembershipProvider\" connectionStringName=\"modelConnectionString\" minRequiredPasswordLength=\"1\" minRequiredNonalphanumericCharacters=\"0\" enablePasswordReset=\"true\" maxInvalidPasswordAttempts=\"1000\" passwordAttemptWindow=\"4000\" enablePasswordRetrieval=\"true\" requiresUniqueEmail=\"false\" passwordFormat=\"Encrypted\" applicationName=\"/WebSite10\"/>
</providers>
</membership>
<machineKey validationKey=\"****\" decryptionKey=\"****\" validation=\"SHA1\" decryption=\"AES\"/>
<compilation debug=\"true\" targetFramework=\"4.0\">
<assemblies>
<add assembly=\"System.Design,Version=4.0.0.0,Culture=neutral,PublicKeyToken=****\"/>
<add assembly=\"System.Web.Extensions.Design,PublicKeyToken=****\"/>
<add assembly=\"System.Windows.Forms,PublicKeyToken=****\"/>
<add assembly=\"System.Data.Linq,PublicKeyToken=****\"/>
</assemblies>
</compilation>
解决方法
您有两个编译标签
<compilation debug=\"true\"/>
和
<compilation debug=\"true\" targetFramework=\"4.0\">
<assemblies>
<add assembly=\"System.Design,Version=4.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A\"/>
<add assembly=\"System.Web.Extensions.Design,PublicKeyToken=31BF3856AD364E35\"/>
<add assembly=\"System.Windows.Forms,PublicKeyToken=B77A5C561934E089\"/>
<add assembly=\"System.Data.Linq,PublicKeyToken=B77A5C561934E089\"/>
</assemblies>
</compilation>
, 当您在配置文件中两次包含Compilation元素时,将发生以下错误。只需取出一个或另一个。
似乎有两个部分。
去掉
<compilation>
离开
<compilation debug=\"true\" >
, 我今天在安装Ajax工具包后遇到了这个问题。如果在web.config中通过以下方式安装ajax工具包之前添加了自定义控件:
<pages>
<controls>
<!--Your custom control class information-->
<add tagPrefix=\"..\" namespace=\"...\"/>
</controls>
</pages>
将标签删除为后,将其与ajaxToolkit部分结合:
<pages>
<controls>
<add tagPrefix=\"ajaxToolkit\" assembly=\"AjaxControlToolkit\" namespace=\"AjaxControlToolkit\" />
<!--Your custom control class information-->
<add tagPrefix=\"...\" namespace=\"...\" />
</controls>
</pages>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。