Upload file with google drive from web service c# fail for base uri = null -


i have implemented web service calling class uploads pdf folder on google drive. request list of folders contents.

the problem if called main pdf uploaded , list done.

if webservice makes call list done upload fails , can see exception in response:

the base uri null.

if after calling main try call web service in localhost (via soapui) webservice able upload pdf.

the class implement gdrive api same.

the code used service gdrive is:

var keyfilepath = @"c:\progetti\pippo.p12";        var serviceaccountemail = "reportbatch@appspot.gserviceaccount.com";   var certificate = new x509certificate2(keyfilepath, "notasecret",     x509keystorageflags.exportable);   var credential = new  serviceaccountcredential(new  serviceaccountcredential.initializer(serviceaccountemail)              {                   scopes = scopes               }.fromcertificate(certificate));  var service = new driveservice(new baseclientservice.initializer()               {                   httpclientinitializer = credential,                  applicationname = _applicationname,               }); 

the strange thing listing work, uploading not. seems permission, difference between 2 calls?

i'm blocked reason, can me?

david

ok going have guess , permissions. when run running when web service runs running under application pool web service set with. start make sure web service has access key file.

then change following line

var certificate = new x509certificate2(keyfilepath, "notasecret", x509keystorageflags.exportable);  

to

var certificate = new x509certificate2(keyfilepath, "notasecret", x509keystorageflags.machinekeyset | x509keystorageflags.exportable); 

i have seen above cause issues on azure , fixed might work well.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -