I created a console application to read gmail inbox.I need my console app to read emails every 15 minutes.So i published the console app as webjobs with runmode : "On demand" and published the app using azure services (web apps).
But my webjobs doesn't seem to run and there is no option to schedule a webjob when i select publish as azure webjobs.
As soon as i publish i get this error in visual studio :
'ICICIEmailParser.sstageEntities-Web.config Connection String' argument cannot be null or empty
The webjob has no scheduled time so i manually ran the webjob from azure portal and when viewed log i see below error
[01/03/2017 06:48:38 > 7e6d88: SYS INFO] Status changed to Initializing [01/03/2017 06:48:38 > 7e6d88: SYS INFO] Job directory change detected: Job file 'ICICIEmailParser.application' timestamp differs between source and working directories. [01/03/2017 06:48:39 > 7e6d88: SYS INFO] Run script 'ICICIEmailParser.exe' with script host - 'WindowsScriptHost' [01/03/2017 06:48:39 > 7e6d88: SYS INFO] Status changed to Running [01/03/2017 06:48:40 > 7e6d88: ERR ] [01/03/2017 06:48:40 > 7e6d88: ERR ] Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.Net.HttpListenerException: Access is denied [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Net.HttpListener.SetupV2Config() [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Net.HttpListener.Start() [01/03/2017 06:48:40 > 7e6d88: ERR ] at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.d__6.MoveNext() [01/03/2017 06:48:40 > 7e6d88: ERR ] --- End of stack trace from previous location where exception was thrown --- [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [01/03/2017 06:48:40 > 7e6d88: ERR ] at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.d__8.MoveNext() [01/03/2017 06:48:40 > 7e6d88: ERR ] --- End of stack trace from previous location where exception was thrown --- [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [01/03/2017 06:48:40 > 7e6d88: ERR ] at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__4.MoveNext() [01/03/2017 06:48:40 > 7e6d88: ERR ] --- End of stack trace from previous location where exception was thrown --- [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [01/03/2017 06:48:40 > 7e6d88: ERR ] at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__1.MoveNext() [01/03/2017 06:48:40 > 7e6d88: ERR ] --- End of inner exception stack trace --- [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification) [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Threading.Tasks.Task
1.get_Result() [01/03/2017 06:48:40 > 7e6d88: ERR ] at GmailQuickstart.Program.d__3.MoveNext() [01/03/2017 06:48:40 > 7e6d88: ERR ] --- End of inner exception stack trace --- [01/03/2017 06:48:40 > 7e6d88: ERR ] at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) [01/03/2017 06:48:40 > 7e6d88: ERR ] at GmailQuickstart.Program.Main(String[] args) [01/03/2017 06:48:40 > 7e6d88: SYS INFO] Status changed to Failed [01/03/2017 06:48:40 > 7e6d88: SYS ERR ] Job failed due to exit code -532462766
Things i have done :
I have a client-secret.json file of google oauth. I have added google secret and client id in my azure web app authentication/authorization I set javascript origin and redirect uri in google developer console
This is my main method :
static void Main(string[] args)
{
Task.WaitAll(GetEmail());
}
static async Task GetEmail() {
//my c# code to read gmail inbox...
}
Any help would be appreciated !
Thanks in advance