【问题标题】:configuring asp.net web.config for Paypal为 Paypal 配置 asp.net web.config
【发布时间】:2015-07-12 04:40:10
【问题描述】:

我从 github paypal net sdk 页面复制了以下 web.config,但得到一个错误,提示找不到元素 ;Paypal' 的架构信息。我的 web.config 语法有问题吗(这是针对 asp.net 网站的):

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
  <configSections>
    <section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
  </configSections>

  <!-- PayPal SDK settings -->
  <paypal>
    <settings>
      <add name="mode" value="sandbox"/>
      <add name="clientId" value="_client_Id_"/>
      <add name="clientSecret" value="_client_secret_"/>
    </settings>
  </paypal>
</configuration>

【问题讨论】:

    标签: asp.net paypal


    【解决方案1】:

    根据the documentation found here,您的代码看起来是正确的。

    您确定为 Paypal 提供了适当的参考资料(通过 NuGet 或手动)?

    此外,您似乎缺少一个开头的 &lt;configuration&gt; 元素,这也可能是一个问题(除非这只是一个错字):

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <configSections>
        <section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
      </configSections>
    
      <!-- PayPal SDK settings -->
      <paypal>
        <settings>
          <add name="mode" value="sandbox"/>
          <add name="clientId" value="_client_Id_"/>
          <add name="clientSecret" value="_client_secret_"/>
        </settings>
      </paypal>
    </configuration>
    

    【讨论】:

    • This page 具有适用于 PayPal .NET SDK 的正确 web.config 设置。您指向的链接是旧版核心 SDK,现在仅与经典 SDK(商家、自适应支付等)一起使用。两者之间的主要区别在于SDKConfigHandler 的命名空间,它在 PayPal .NET SDK 中进行了更改以避免命名空间冲突。除此之外,这个答案是正确的。 :)
    • 它仍然不起作用,即使我在部分中输入:"
      " 而不是指定的那个在页面上。我确实安装了 Paypal NET SDK,包文件告诉我我有:
    • @GordonDugan 这与 GitHub 上的 this issue 有关吗?
    • 是的,同样的问题。我现在发现错误不在 web.config 中,但它产生了 VS“认为”在 web.config 中的错误。
    猜你喜欢
    • 1970-01-01
    • 2012-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-06
    • 2013-06-01
    • 2015-02-16
    • 1970-01-01
    相关资源
    最近更新 更多