I was created MVC web app to post event on google calendar. after meany attempts it worked fine in localhost. but today when i host it in a online iis webserver it giving following error message, (all the google settings in developer account done correctly )
here is my code:
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = siteinfoCalendar.ClientId,
ClientSecret = siteinfoCalendar.ClientSecret,
},
new[] { CalendarService.Scope.Calendar },
townName,
CancellationToken.None,
new DBDataStotre()).Result;
// Create Google Calendar API service.
var service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = siteInfo.TownName,
});
string description = calendarInfo.FirstOrDefault().Issue.Replace("&", "").Replace("<", "").Replace(">", "").Replace(""", "").Replace("'", "").Replace("<br />", "").Replace(" ", "");
Event newPtoEvent = new Event();
newPtoEvent.Summary = calendarInfo.FirstOrDefault().UserName + " on " + leaveDescription.Trim() + " leave.";
newPtoEvent.Description = calendarInfo.FirstOrDefault().Issue;
newPtoEvent.Start = new EventDateTime();
newPtoEvent.Start.DateTime = calendarInfo.FirstOrDefault().StartDateLocalTime;
newPtoEvent.End = new EventDateTime();
newPtoEvent.End.DateTime = calendarInfo.FirstOrDefault().EndDateLocalTime;
var createCalendarEvent = service.Events.Insert(newPtoEvent, siteinfoCalendar.CalendarID);
Task.Run(() => { createCalendarEvent.Execute(); });
it was worked on localhost with no issue, but now when it is hosted on iis hosting server, it giving bellow stack trace error message:
One or more errors occurred. mscorlib at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at LibTsService.ServiceRequests.GoogleCalendar.PTOCalendarUpdate.UpdateClendar(Int32 complaintId, IDbConnection& con) at LibTsService.ServiceRequests.SrStatusUpdateService.DeclineApprovePto(Boolean isStaffMember) at LibTsService.ServiceRequests.SrStatusUpdateService.Any(SrStatusUpdate request) Access is denied System at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__1.MoveNext() Exception.ToString(): System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: Access is denied at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at Google.Apis.Auth.OAuth2.LocalServerCodeReceiver.d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__1.MoveNext() --- End of inner exception stack trace ---
So what is the reason for this to not working in online host ?