ews-managed-api icon indicating copy to clipboard operation
ews-managed-api copied to clipboard

Kerberos error on Dotnet core on debian

Open ooaa30 opened this issue 7 years ago • 4 comments

after attempting to run a small hello world program using EWS on a raspberry pi I encountered the following exception (email address scrubbed): Unhandled Exception: System.ComponentModel.Win32Exception: GSSAPI operation failed with error - An invalid status code was supplied (Cannot find KDC for realm "email.com").

My code with email and passwords scrubbed is:

using System;
using Microsoft.Exchange.WebServices.Data;

namespace Test
{
class Program
{
    static void Main(string[] args)

    {
            // Create the binding to ews
            ExchangeService service = new ExchangeService();
            // Set the credentials for the user
            service.Credentials = new WebCredentials("[email protected]", "password");
            // Set the URL
            service.Url = new Uri("https://email.com/ews/Exchange.asmx");
            // Create a bew email
            EmailMessage email = new EmailMessage(service);
            // Set the recipiant to an email
            email.ToRecipients.Add("[email protected]");
            // Set the subject
            email.Subject = "HelloWorld";
            // Set the body
            email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API.");
            email.Send();
    }
}
}

ooaa30 avatar Jul 23 '18 10:07 ooaa30

I tried to get it to work for weeks. We ended up deploying to a Windows Server.

mackcoding avatar Sep 11 '18 13:09 mackcoding

Hi @ooaa30 did you managed this one to work? We're getting the same issue. :(

sjzamora86 avatar Oct 19 '18 05:10 sjzamora86

@sjzamora86 I ended up deploying a Windows server just to get it to work.

mackcoding avatar Oct 30 '18 18:10 mackcoding

@mackcoding apparently this is not happening using core 2.0 and it is only in 2.1. I tried to do the same in below article and it works. https://stackoverflow.com/questions/52266659/net-core-spnego-auth-with-httpclient

Based on my understanding, there's a socket handler introduced in 2.1 which needs to be authenticated as well which throws this error.

sjzamora86 avatar Nov 01 '18 23:11 sjzamora86