Azure 移动服务 web.config 未在服务器上更新

Azure Mobile Service web.config does not update on server

我在web.config中添加了paypal配置,我可以通过本地服务器连接paypal。

但是发布到AMS服务器时,它不起作用。

我收到以下错误

无法解析 *.Config 文件。确保您已正确配置 'paypal' 部分。

<paypal>
<settings>
  <add name="mode" value="sandbox" />
  <add name="connectionTimeout" value="360000" />
  <add name="requestRetries" value="1" />
  <add name="clientId" value="xxx" />
  <add name="clientSecret" value="ccc" />
</settings>
</paypal>

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
    <section name="log4net"         type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  </configSections>

  <!-- PayPal SDK settings -->
  <paypal>
    <settings>
      <add name="mode" value="sandbox"/>
      <add name="connectionTimeout" value="360000"/>
      <add name="requestRetries" value="1"/>
      <add name="clientId" value="xxxxx"/>
      <add name="clientSecret" value="cccc"/>
    </settings>
  </paypal>

  <!-- log4net settings -->
  <log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
      <file value="my_app.log"/>
      <appendToFile value="true"/>
      <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline"/>
      </layout>
    </appender>
    <root>
      <level value="DEBUG"/>
      <appender-ref ref="FileAppender"/>
    </root>
  </log4net>


  <appSettings>
    <add key="PayPalLogger" value="PayPal.Log.Log4netLogger"/>
    <add key="PreserveLoginUrl" value="true" />   
  </appSettings>

  <system.web>
    <httpRuntime targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5" />
  </system.web>

  <system.webServer>

  </system.webServer>

</configuration>

好的,我已经解决了这个问题。只需使用 ConfigurationManager 而不是使用 PayPal Api ConfigManager.Instance.GetProperties()

// Create the configuration map that contains mode and other optional configuration details.
    public static Dictionary<string, string> GetConfig()
    {
        Dictionary<string, string> configurationMap = new Dictionary<string, string>();
        configurationMap.Add("mode", ConfigurationManager.AppSettings["mode"]);
        configurationMap.Add("clientId", ConfigurationManager.AppSettings["clientId"]);
        configurationMap.Add("clientSecret", ConfigurationManager.AppSettings["clientSecret"]);
        return configurationMap;
        //return ConfigManager.Instance.GetProperties();
    }