开发者社区> 问答> 正文

.NETSDK开发包(20140626总是异常!!


同样的代码粘贴到java里面就可以运行,哪位指点一下,很郁闷


环境 :win7 vs2008  .net3.5 SDK(2014-06-26)
代码:
-------------------------------------
            String accessKeyId = "";
            String accessKeySecret = "";
            String endPoint = "http://oss-cn-beijing.aliyuncs.com";
            // 初始化一个OSSClient
            client = new OssClient(endPoint,accessKeyId, accessKeySecret);
            client.ListBuckets();
-------------------------------------
总是提示异常

未处理 System.NullReferenceException
  Message="未将对象引用设置到对象的实例。"
  Source="Aliyun.OpenServices"
  StackTrace:
       在 Aliyun.OpenServices.Common.Communication.RetryableServiceClient.SendImpl(ServiceRequest request, ExecutionContext context, Int32 retries) 位置 d:\Work\API\openapi\dotnet\aliyunapi\Common\Communication\RetryableServiceClient.cs:行号 82
       在 Aliyun.OpenServices.Common.Communication.RetryableServiceClient.Send(ServiceRequest request, ExecutionContext context) 位置 d:\Work\API\openapi\dotnet\aliyunapi\Common\Communication\RetryableServiceClient.cs:行号 54
       在 Aliyun.OpenServices.OpenStorageService.Commands.OssCommand.Execute() 位置 d:\Work\API\openapi\dotnet\aliyunapi\OpenStorageService\Commands\OssCommand.cs:行号 76
       在 Aliyun.OpenServices.OpenStorageService.Commands.OssCommand`1.Execute() 位置 d:\Work\API\openapi\dotnet\aliyunapi\OpenStorageService\Commands\OssCommand.cs:行号 125
       在 Aliyun.OpenServices.OpenStorageService.OssClient.ListBuckets() 位置 d:\Work\API\openapi\dotnet\aliyunapi\OpenStorageService\OssClient.cs:行号 129
       在 WindowsFormsApplication2.Form1.button1_Click(Object sender, EventArgs e) 位置 C:\Users\jji\Documents\Visual Studio 2008\Projects\WindowsFormsApplication2\WindowsFormsApplication2\Form1.cs:行号 30
       在 System.Windows.Forms.Control.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.OnClick(EventArgs e)
       在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       在 System.Windows.Forms.Control.WndProc(Message& m)
       在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
       在 System.Windows.Forms.Button.WndProc(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       在 System.Windows.Forms.Application.Run(Form mainForm)
       在 WindowsFormsApplication2.Program.Main() 位置 C:\Users\jji\Documents\Visual Studio 2008\Projects\WindowsFormsApplication2\WindowsFormsApplication2\Program.cs:行号 17
       在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException:

展开
收起
5thapple 2014-07-17 18:18:39 8798 0
2 条回答
写回答
取消 提交回答
  • ReNETSDK开发包(20140626总是异常!!
    楼主后来解决了吗? 我在Unity环境同样遇到这问题
    2014-09-23 22:22:42
    赞同 展开评论 打赏
  • LT是个伪程序员
      String accessKeyId = "";
      String accessKeySecret = "";

    这个为空,能初始化么?还是楼主贴代码的时候省略了?

    -------------------------

    改为杭州节点或青岛节点试试呢?

    2014-07-24 09:55:24
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
从 SDK 到编解码:视频直播架构解析 立即下载
跨平台的云服务SDK需要什么 立即下载
一个跨平台的云服务SDK需要什么 立即下载