首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

新浪微博C# SDK Demo运行时报错解决方法

2013-04-02 
新浪微博C# SDK Demo运行时报错非常纳闷,AppKey跟AppSecret都更换了,回调地址也设置好了,但运行时就说没

新浪微博C# SDK Demo运行时报错
新浪微博C# SDK Demo运行时报错解决方法非常纳闷,AppKey跟AppSecret都更换了,回调地址也设置好了,但运行时就说"没有找到设置属性“1334886379”。"这AppKey是我刚创建的微博应用申请的
      [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("1334886379")]
        public string AppKey {
            get {
                return ((string)(this["1334886379"]));
            }
            set {
                this["1334886379"] = value;
            }
        }
        
        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("a355c237795f55c073dc8885b45b821d")]
        public string AppSecret {
            get {
                return ((string)(this["a355c237795f55c073dc8885b45b821d"]));
            }
            set {
                this["a355c237795f55c073dc8885b45b821d"] = value;
            }
        }
        
        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("http://127.0.0.1")]
        public string CallbackUrl {
            get {
                return ((string)(this["http://127.0.0.1"]));
            }
            set {
                this["http://127.0.0.1"] = value;
            }
        } 新浪微博 c#
[解决办法]
不是这样搞的吧,你有申明这个类下的1334886379 属性,你的属性应该是AppKey 吧?
这样看看
string appKey = "1334886379";//没有必要还专门通过属性名称来赋值吧?


public string AppKey {
            get {
                return appKey;
            }
            set {
                appKey= value;
            }
        }

[解决办法]
如果觉得按你的方式写,语法的地方改下:
[UserScopedSettingAttribute()]
[DefaultSettingValueAttribute("1334886379")]
 public string AppKey 
    {
        get { return (string)this["AppKey"]; }//注意,里边不是1334886379 啊,那是默认值
        set { this["AppKey"] = value; }
    }

热点排行