Error: Access Denied on IIS using Google Youtube Data API V3 Oauth service

拜拜、爱过 提交于 2019-12-13 07:26:38

问题


I have created a web page (youtubeuploader.aspx) in asp.net to upload Video to youtube channel on button click. The video file location say eg: 'd:\\youtubevdos\\test.3gp'.

I have hosted this web application in IIS7.

This page works fine on local machine with proper Oauth2.0 authentication and Video is uploaded to youtube channel. But, it wont work when hosted on web server i mean IIS server

It gives error:

"Access Denied" Access to path/directory 'App_Data' is denied.

UserCredential credential;
//string googleaccesstoken = Server.MapPath("mygooglestorage");
string googleaccesstoken = "D:\\websites\\mygooglestorage\\";
//using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
using (var stream = new FileStream(jsonpath, FileMode.Open, FileAccess.Read))
{

    credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
        GoogleClientSecrets.Load(stream).Secrets,
        // This OAuth 2.0 access scope allows an application to upload files to the
        // authenticated user's YouTube channel, but doesn't allow other types of access.
        new[] { YouTubeService.Scope.YoutubeUpload, YouTubeService.Scope.YoutubeUpload, YouTubeService.Scope.Youtube },
        "user",
        CancellationToken.None,
        new FileDataStore(googleaccesstoken)
    );
}

I have tried following ways:

  • Explicitly setting the FileDataStore while authentication i.e specifying file location something to 'D:\websites\myproj\authkey\' but still same error.

  • Created a folder in hosted location as given above and given access rights as 'FullControl' to folder still same error.

Note: i am using GoogleAuthorizationCodeFlow, Google Youtube API v3, OAuth2.0

Any suggestions?

Help Appreciated!


回答1:


Try this - Give all permissions to app data folder for users - IUSER and Network Service.



来源:https://stackoverflow.com/questions/44821678/error-access-denied-on-iis-using-google-youtube-data-api-v3-oauth-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!