Kerberos error on Dotnet core on debian
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();
}
}
}
I tried to get it to work for weeks. We ended up deploying to a Windows Server.
Hi @ooaa30 did you managed this one to work? We're getting the same issue. :(
@sjzamora86 I ended up deploying a Windows server just to get it to work.
@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.