当前位置:首页 > 服务器技术 > IIS

c# – YouTube数据API(v3)在Windows服务器(IIS)中托管

我正在使用此代码在youtube上上传视频

InsertVideoYoutube via .net

代码在我的本地机器上工作正常,但是当我在我的IIS上托管我的API时出现异常

这是我得到的例外

Object reference not set to an instance of an object. System.Collections.ListDictionaryInternal at BusinessClass.UploadVideo.videosInsertRequest_ProgressChanged(IUploadProgress progress) at Google.Apis.Upload.ResumableUpload1.<UploadAsync>d__84.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at BusinessClass.UploadVideo.d__1.MoveNext() Object reference not set to an instance of an object. Void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress)

使用client_secrets.json文件进行授权.

解决方法:

解决了这个问题,因为在这个文件夹中我得到了未授权的异常

C:UsersAdministratorAppDataRoamingGoogle.Apis.AuthGoogle.Apis.Auth.OAuth2.Responses.TokenResponse-user

IIS用户无权访问,因此我将此“Google.Apis.Auth”文件夹的权限授予IIS用户.最后异常消失,Code工作正常,感谢您的帮助


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!