【发布时间】:2017-06-29 09:44:56
【问题描述】:
我在asp.net 到upload Video to youtube channel 在button click 上创建了一个网页(youtubeuploader.aspx)。
视频文件位置例如:
'd:\\youtubevdos\\test.3gp'.
我在IIS7 中有hosted 这个Web 应用程序。
此页面在本地机器上正常工作,正确的Oauth2.0 authentication 和Video 上传到youtube channel。 但是,当托管在 Web 服务器上时,它不会工作,我的意思是 IIS 服务器
报错:
“拒绝访问”拒绝访问路径/目录“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)
);
}
我尝试了以下方法:
在身份验证时显式设置
FileDataStore,即将文件位置指定为'D:\websites\myproj\authkey\',但仍然是同样的错误。如上所述在托管位置创建了一个文件夹,并将
access rights作为'FullControl'赋予文件夹仍然相同的错误。
注意:我使用的是GoogleAuthorizationCodeFlow、Google Youtube API v3、OAuth2.0
有什么建议吗?
帮助赞赏!
【问题讨论】:
标签: google-api iis-7 youtube-data-api