4

I am using this code to upload video on youtube

InsertVideoYoutube via .net

Code is working fine in my local machine but getting exception when i host my api on my IIS

Here is the exception what i am getting

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)

Using client_secrets.json file for authorization.

Suffian Shaukat
  • 265
  • 1
  • 2
  • 7
  • Possible duplicate of [What is a NullReferenceException, and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Tetsuya Yamamoto Jan 23 '17 at 09:27
  • not duplicate, because in my case code is working fine in local machine, but same code not working in hosting server, may be some permission issue but not sure – Suffian Shaukat Jan 23 '17 at 09:35

1 Answers1

4

Resolved the issue, I was getting unauthorize exception because in this folder

C:\Users\Administrator\AppData\Roaming\Google.Apis.Auth\Google.Apis.Auth.OAuth2.Responses.TokenResponse-user

There was no access for IIS Users, So i gave permission of this 'Google.Apis.Auth' folder to IIS user. And finally exception is gone, Code is working properly, Thanks for your help

Suffian Shaukat
  • 265
  • 1
  • 2
  • 7