问题
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