@@ -44,15 +44,36 @@ public class Config
4444 /// <summary>
4545 /// 初始化七牛帐户、请求地址等信息,不应在客户端调用。
4646 /// </summary>
47- public static void Init ( )
47+ public static void Init ( )
4848 {
49- USER_AGENT = System . Configuration . ConfigurationManager . AppSettings [ "USER_AGENT" ] ;
50- ACCESS_KEY = System . Configuration . ConfigurationManager . AppSettings [ "ACCESS_KEY" ] ;
51- SECRET_KEY = System . Configuration . ConfigurationManager . AppSettings [ "SECRET_KEY" ] ;
52- RS_HOST = System . Configuration . ConfigurationManager . AppSettings [ "RS_HOST" ] ;
53- UP_HOST = System . Configuration . ConfigurationManager . AppSettings [ "UP_HOST" ] ;
54- RSF_HOST = System . Configuration . ConfigurationManager . AppSettings [ "RSF_HOST" ] ;
55- PREFETCH_HOST = System . Configuration . ConfigurationManager . AppSettings [ "PREFETCH_HOST" ] ;
49+ if ( System . Configuration . ConfigurationManager . AppSettings [ "USER_AGENT" ] != null )
50+ {
51+ USER_AGENT = System . Configuration . ConfigurationManager . AppSettings [ "USER_AGENT" ] ;
52+ }
53+ if ( System . Configuration . ConfigurationManager . AppSettings [ "ACCESS_KEY" ] != null )
54+ {
55+ ACCESS_KEY = System . Configuration . ConfigurationManager . AppSettings [ "ACCESS_KEY" ] ;
56+ }
57+ if ( System . Configuration . ConfigurationManager . AppSettings [ "SECRET_KEY" ] != null )
58+ {
59+ SECRET_KEY = System . Configuration . ConfigurationManager . AppSettings [ "SECRET_KEY" ] ;
60+ }
61+ if ( System . Configuration . ConfigurationManager . AppSettings [ "RS_HOST" ] != null )
62+ {
63+ RS_HOST = System . Configuration . ConfigurationManager . AppSettings [ "RS_HOST" ] ;
64+ }
65+ if ( System . Configuration . ConfigurationManager . AppSettings [ "UP_HOST" ] != null )
66+ {
67+ UP_HOST = System . Configuration . ConfigurationManager . AppSettings [ "UP_HOST" ] ;
68+ }
69+ if ( System . Configuration . ConfigurationManager . AppSettings [ "RSF_HOST" ] != null )
70+ {
71+ RSF_HOST = System . Configuration . ConfigurationManager . AppSettings [ "RSF_HOST" ] ;
72+ }
73+ if ( System . Configuration . ConfigurationManager . AppSettings [ "PREFETCH_HOST" ] != null )
74+ {
75+ PREFETCH_HOST = System . Configuration . ConfigurationManager . AppSettings [ "PREFETCH_HOST" ] ;
76+ }
5677 }
5778 private static string getUa ( )
5879 {
0 commit comments