在服务帐户Exchange模拟:自动发现服务找不到 [英] Exchange Impersonation in Service Account: Autodiscover service couldn't be located

查看:1334
本文介绍了在服务帐户Exchange模拟:自动发现服务找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发送至EWS一个简单的电子邮件正在按预期 - 从我的账户到我的账户:

Sending a simple email through ews is working as intended - from my account to my account:

ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010);
ews.AutodiscoverUrl("myname@mydomain.com");
EmailMessage email = new EmailMessage(ews);
email.ToRecipients.Add("myname@mydomain.com");
email.Subject = "HelloWorld";
email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
email.Send();



只是试图模拟,它也如预期运行 - 在最后一行,则返回错误我不允许模仿:

Simply trying impersonation, it is also working as intended - in the last line, it returns the error that I am not allowed to impersonate:

ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010);
ews.AutodiscoverUrl("myname@mydomain.com");
ews.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "testuser@mydomain.com");
EmailMessage email = new EmailMessage(ews);
email.ToRecipients.Add("myname@mydomain.com");
email.Subject = "HelloWorld";
email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
email.Send();

现在我试着与我的应用程序服务帐户,而不是登录:

Now I try to login with my application service account instead:

ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010);
ews.Credentials = new NetworkCredential("service", "1234", "mydomain.com");
//ews.Credentials = new WebCredentials("service", "1234");
ews.AutodiscoverUrl("myname@mydomain.com");
//ews.AutodiscoverUrl("service@mydomain.com");
ews.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "testuser@mydomain.com");
EmailMessage email = new EmailMessage(ews);
email.ToRecipients.Add("myname@mydomain.com");
email.Subject = "HelloWorld";
email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
email.Send();



但在这里它抛出自动发现行的错误:AutodiscoverLocalException:自动发现服务不能位于

But here it throws an error in the autodiscover line: "AutodiscoverLocalException: The Autodiscover service couldn't be located."

服务帐户设置AD和交流,正确的密码和SMTP地址。

The service account is set up in AD and Exchange, with correct password and smtp address.

为什么不工作? ?如何检查是什么导致了这个错误。

Why isn't it working? How can I check what's causing that error?

推荐答案

我解决了这个问题,并猜测是什么问题:它的用户帐户

I solved the problem, and guess what the problem is: it's the user account.

EWS使用给定的凭据本身的访问自动发现服务验证在

EWS uses the given credentials to authenticate itself for access to the Autodiscover service at

http://mydomain/AutoDiscover/AutoDiscover.xml

的凭据是正确的,但似乎已设置为帐户用户必须在首次登录时更改密码,进入自动发现服务被拒绝。我改变了在公元设置,现在它的作品。

The credentials were correct, but it seems that for accounts set to "user has to change password on first login", access to the autodiscover service is denied. I changed that setting in AD and now it works.

这篇关于在服务帐户Exchange模拟:自动发现服务找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆