Je télécharge une application console C# en tant que Webjob Azure. L'erreur que je reçois est:Azure Webjob: C# - Impossible de localiser le service de découverte automatique
Exception non gérée: Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException: Le service de découverte automatique ne pouvait pas se trouver.
à Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings [TSettings] (String emailAddress, List1 redirectionEmailAddresses, Int32 & currentHop)
à Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetLegacyUserSettings [TSettings] (String emailAddress)
à Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings (String emailAddress, List`1 requestedSettings)
à Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings (String userSmtpAddress, UserSettingName [] userSettingNames)
à Microsoft.Exchange.WebServices.Data.ExchangeService.GetAutodiscoverUrl (String emailAddress, ExchangeVersion requestedServerVersion, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)
à Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl (String emailAddress, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)
Voici mon code:
private static bool RedirectionUrlValidationCallback(string redirectionUrl)
{
// The default for the validation callback is to reject the URL.
bool result = false;
Uri redirectionUri = new Uri(redirectionUrl);
// Validate the contents of the redirection URL. In this simple validation
// callback, the redirection URL is considered valid if it is using HTTPS
// to encrypt the authentication credentials.
if (redirectionUri.Scheme == "https")
{
result = true;
}
return result;
}
static void Main(string[] args)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new WebCredentials("[email protected]", "myPassword", "mysite.com");
service.AutodiscoverUrl("[email protected]", RedirectionUrlValidationCallback);
// More irrelevant code here
}
Le code ci-dessus était pris de cette question comme Acceptée Réponse: Connection to Office 365 by EWS API
L'exécution de ce code sur ma machine comme une application de la console, exécute ça va. Mais cette erreur en tant que webjob, quelqu'un peut-il aider?
j'ai eu des problèmes à l'aide de SAP sur Azure et après la chasse pour trouver des réponses finalement juste décidé de lancer l'application de la console sur un serveur local à la place et utiliser le Planificateur de tâches pour le faire fonctionner sur un calendrier établi – hellyale
@hellyale je espère pouvoir diagnostiquer le problème, mais malheureusement, je n'ai pas le confort de recourir à un serveur local pour la procédure. :( – NoReceipt4Panda