Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
484 views
in Technique[技术] by (71.8m points)

google-api - 错误:使用Google Youtube Data API V3 Oauth服务在IIS上拒绝访问(Error: Access Denied on IIS using Google Youtube Data API V3 Oauth service)

I have created a web page (youtubeuploader.aspx) in asp.net to upload Video to youtube channel on button click .

(我在asp.net创建了一个网页(youtubeuploader.aspx) ,可以在click button upload Video to youtube channel 。)

The video file location say eg: 'd:\\youtubevdos\\test.3gp'.

(视频文件的位置例如: 'd:\\youtubevdos\\test.3gp'.)

I have hosted this web application in IIS7 .

(我已经在IIS7 hosted该Web应用程序。)

This page works fine on local machine with proper Oauth2.0 authentication and Video is uploaded to youtube channel .

(此页面在具有正确Oauth2.0 authentication本地计算机上运行良好,并且Video已上传到youtube channel 。)

But, it wont work when hosted on web server i mean IIS server

(但是,当托管在Web服务器上时,它将无法工作,我的意思是IIS服务器)

It gives error:

(它给出了错误:)

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

(“访问被拒绝”拒绝访问路径/目录“ App_Data”。)

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 ie specifying file location something to 'D:\websites\myproj\authkey\' but still same error.

    (身份验证时显式设置FileDataStore ,即将文件位置指定为'D:\websites\myproj\authkey\'但仍存在相同错误。)

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

    (如上所述,在托管位置创建了一个文件夹,并赋予了对文件夹同样的错误'FullControl' access rights 。)

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

(注意:我正在使用GoogleAuthorizationCodeFlowGoogle Youtube API v3OAuth2.0)

Any suggestions?

(有什么建议么?)

Help Appreciated!

(帮助赞赏!)

  ask by SHEKHAR SHETE translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

尝试此操作-为用户授予对应用程序数据文件夹的所有权限-IUSER和网络服务。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...