开发者社区> 问答> 正文

C#的OSS无法连接服务器?

我使用C#在unity里写如下代码:

    try {
        ClientConfiguration conf = new ClientConfiguration();
        conf.MaxErrorRetry = 3;
        conf.ConnectionTimeout = 300;
        // conf.IsCname = true;
        client = new OssClient(endpoint, accessKeyId, accessKeySecret, conf);
        Debug.LogFormat("Connect aliyun successed! {0}", client);
    } catch (ClientException e) {
        Debug.LogErrorFormat("Client exception: {0}", e.Message);
    } catch (OssException e) {
        Debug.LogErrorFormat("Oss exception: {0}", e.Message);
    } catch (System.Exception e) {
        Debug.LogErrorFormat("Connect aliyun failed, Reason:{0}", e.Message);
    }

这里运行并没有任何异常,但只要调用client对象的任意一个函数就会抛异常,内容为:Object reference not set to an instance of an object,请问这是什么情况。

展开
收起
hubluesky 2017-07-31 16:48:40 2377 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
OSS运维进阶实战手册 立即下载
《OSS运维基础实战手册》 立即下载
OSS运维基础实战手册 立即下载