错误:使用Google Youtube Data API V3 Oauth服务在IIS上拒绝访问 [英] Error: Access Denied on IIS using Google Youtube Data API V3 Oauth service
问题描述
我在 asp.net
到(youtubeuploader.aspx)
>将视频上传到YouTube频道点击按钮
点击
。
视频文件的位置,例如:
'd:\\youtubevdos\\test.3gp'。
我在 IIS7
中拥有托管
这个Web应用程序。
这个页面在本地机器上正常工作,并且正确 Oauth2.0认证
和视频
上传到 youtube
频道
。 但是,它托管在Web服务器上时不会工作,我的意思是IIS服务器
它给出错误:
拒绝访问访问路径/目录'App_Data'被拒绝。
UserCredential凭证;
// string googleaccesstoken = Server.MapPath(mygooglestorage);
string googleaccesstoken =D:\\websites\\mygooglestorage\\;
//使用(var stream = new FileStream(client_secrets.json,FileMode.Open,FileAccess.Read))
using(var stream = new FileStream(jsonpath,FileMode.Open,FileAccess.Read ))
{
凭证=等待GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
//此OAuth 2.0访问范围允许应用程序上传文件到
//经过认证的用户的YouTube频道,但不允许其他类型的访问。 },
user,
CancellationToken.None,
new FileDataStore(googleaccesstoken)
);
}
我试过以下方法:
-
显式设置
FileDataStore
进行身份验证,即将文件位置指定为'D:\\ \\网站\myproj\authkey\'
但仍然是相同的错误。 并给出
访问权限
为'FullControl'
至文件夹仍存在相同错误。 注意:我使用 GoogleAuthorizationCodeFlow
, Google Youtube API v3 ,
OAuth2.0
有什么建议?
帮助赞赏!
试试这个 - 授予应用数据文件夹的所有权限用户 - IUSER和网络服务。
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!
Try this - Give all permissions to app data folder for users - IUSER and Network Service.
这篇关于错误:使用Google Youtube Data API V3 Oauth服务在IIS上拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!