Winforms 无法分析*.Config文件

Winforms 无法分析*.Config文件,winforms,api,config,Winforms,Api,Config,在.NET 4.5 Winforms应用程序中,使用PayPal API文档中的精确代码,我得到: “无法分析*.Config文件。请确保已正确配置“paypal”部分。” 我只是发布了导致这种情况的一行: OAuthTokenCredential tokenCredential=新的OAuthTokenCredential(“xxxxxxxxxxxxx”、“xxxxxxxxx”) 有什么办法吗 谢谢因为史蒂夫选择了迟钝,如果还有其他人有这个问题,这里是一个类似问题的链接,它解决了我的问题。可能

在.NET 4.5 Winforms应用程序中,使用PayPal API文档中的精确代码,我得到:

“无法分析*.Config文件。请确保已正确配置“paypal”部分。”

我只是发布了导致这种情况的一行: OAuthTokenCredential tokenCredential=新的OAuthTokenCredential(“xxxxxxxxxxxxx”、“xxxxxxxxx”)

有什么办法吗


谢谢

因为史蒂夫选择了迟钝,如果还有其他人有这个问题,这里是一个类似问题的链接,它解决了我的问题。可能是我缺乏使用app.config文件的经验,但我必须确保将代码作为文件中的第一个条目插入,否则我的HttpClient类在启动时失败

让我走上正确道路的链接:

My App.config文件(添加NuGet PayPal REST SDK包和上面链接中解决方案的部分后,新VS2013 WinForms项目中的基本App.config文件)

正如在链接中提到的,aaa、bbb、ccc、ddd都来自您的沙箱帐户配置文件



该行不是来自您的配置文件。请更正。这是我的表格代码。Winforms应用程序。但错误显示无法解析配置文件。看那里有意义吗?史蒂夫,你帮不上忙,但谢谢你的努力。我正在帮你。你还没有意识到……但你会的。祝你好运
<configSections>
    <section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK"/>
</configSections>

<paypal>
    <accounts>
        <account  apiUsername="aaa"
                            apiPassword="bbb"
                applicationId="ccc"
                apiSignature="ddd"/>
    </accounts>
    <settings>
        <add name="mode" value="sandbox"/>
    </settings>
</paypal>

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>