如何修复web.config中的重复输入错误
问题描述:
我将我的C#web应用程序上传到GoDaddy,并在访问我网站的某些区域时出现Web.config错误。如何修复web.config中的重复输入错误
我没有得到在我的本地环境中运行相同的web.config和代码的错误。
描述:
错误该请求提供服务所需的配置文件的处理过程中出现。请查看下面的具体错误细节并适当修改您的配置文件。
解析器错误消息:条目'xxxxx'已被添加。
在我的配置文件中。这是我认为会导致错误的部分。
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK" requirePermission="false" />
</configSections>
<paypal>
<settings>
<add name="endpoint" value="https://api.sandbox.paypal.com"/>
<add name="connectionTimeout" value="360000"/>
<add name="requestRetries" value="1"/>
<add name="ClientID" value="id"/>
<add name="ClientSecret" value="secret"/>
</settings>
</paypal>
<configuration>
的错误信息提示,我在我的web.config重复值......每一个出现错误删除了建议重复条目,然后重试时间。
但是,错误不断发生。
我已经看到后续建议在另一篇文章的解决方案,但我不知道把它们放在哪里。
<remove name="xxx" />
<clear />
您能否请帮助。
答
在声明它们之前(使用add),您将使用清除或删除权限。所以,你的配置看起来像这样(假设你的paypal错误导致了这一点 - 你没有发布违规设置)。
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK" requirePermission="false" />
</configSections>
<paypal>
<settings>
<clear/>
<add name="endpoint" value="https://api.sandbox.paypal.com"/>
<add name="connectionTimeout" value="360000"/>
<add name="requestRetries" value="1"/>
<add name="ClientID" value="wefewfewDkeynC90tpFx7vfA-Pliw8uQDjv5RZ10Y_NVspuc88pUPLN6yM"/>
<add name="ClientSecret" value="EdsfdsfdsfdzDomYG2QDHu8jhaAXj4xDZLHadvL5aRfesjwo5c81zbSpRxuE"/>
</settings>
</paypal>
<configuration>
答
我猜你做WebDeploy和它网络配置变换,由于某种原因增加了的EntityFramework额外的部分(当然,它试图与EF迁移有益的,但确实不是好这种方式更多的伤害) 。
你当然没有在本地,但部署web.config
可能会增加额外的部分。该部分很可能在文件的末尾。你能检查服务器上的web.config
究竟是什么吗?
让您的客户端ID和客户端密钥关闭!如果你发布它们,它们不再是秘密!删除它并在没有它们的情况下重新提交。 – DLeh 2014-11-14 15:03:33
你真的认为它是真实的吗? – user1526912 2014-11-14 15:12:47
只是在寻找你。如果它是真实的,现在它保存在stackoverflow的历史中。 – DLeh 2014-11-14 15:29:34