0

i beg for your help with this...

We need to upload videos to Youtube Channel, with a WebForms application. So, this is the main lines of the code i d like to show you:

        var folder = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/GoogleData");
        UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
        new ClientSecrets
        {
            ClientId = ConfigInfo.YouTubeApiClient_id,
            ClientSecret = ConfigInfo.YouTubeAppClient_secret,
        },
         new[] { YouTubeService.Scope.YoutubeUpload },
         "user",
         CancellationToken.None,
        new FileDataStore(folder,true)).Result;

The error i have is: System.ComponentModel.Win32Exception: Access is denied.

Some additional information if it s helpfull:

  • I've created the clientId and the credential in console.developers.google.com as an Application.
  • It works fine on my localhost if i debug the application, but it does not work on the Arvixe shared hosting server.

This is what i ve already tried:

  • The first thing came to my mind was giving Read/Write Permissions on that folder (GoogleData), so i done that but still same error.
  • I ve also asked Arvixe support team to give Everyone-Full Control access to that folder (they say they ve already done that, but not sure)
  • I ve also tried to remove the FileDataSource parameter and use GoogleWebAuthorizationBroker.Folder, but same error.
  • I ve read all the Google Examples, and codes, but all of them are for console or desktop application, and i have a web application with a web server.

Please, any help you can give us will be really appreciated ! Thanks again !

Ariel
  • 23
  • 1
  • 5
  • Having the exact same problem. We run our own servers (I do not have access to them). Works on local machine with Visual Studio set to IIS Express, but gives the exact same error on our dev servers (which are duplicates of our live servers). At first I also thought it was the FileDataStore, bit I found a sample of a DatabaseDataStore (github.com/LindaLawton/Google-Dotnet-Samples/blob/master/…) which I implemented. Still no success, but eliminating any file permission issues. – Talib May 04 '15 at 07:42
  • I have a suspicion it has to do with user rights and not folder/file rights. I cannot test this as i do not have direct access to the servers and now need to get permission to make changes, so it won't happen quickly. And i am not sure what to ask the sysadmin to do. This answer put me on that track: http://stackoverflow.com/questions/14194146/system-componentmodel-win32exception-access-is-denied-error . But it relates to services. – Talib May 04 '15 at 14:10
  • Hey ! some progress here: 1) Run the project on your localhost with VS 2) The file needed by Google.Apis is created with a token inside on the folder you mapped (app_data/GoogleData in my case). 3) Copy that file into the production site on same folder. It will work, but i m testing if the token is renewed automatically or not. But the issue was creating the file ! – Ariel May 04 '15 at 19:07

1 Answers1

0

I recently had a very similar issue to yours, and also hosted on Arvixe. I fixed it by changing the .NET target framework version from 4.5.2 to 4.5.

I wrote a short article about it that has some more info, and more solutions to try. I hope this helps!

Brendan L
  • 1,436
  • 14
  • 13