开发者社区 问答 正文

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 2416 分享 版权
阿里云 AI 助理回答

[203] :api鉴权失败

有帮助
无帮助
AI 助理回答生成答案可能存在不准确,仅供参考
0 条回答
写回答
取消 提交回答