简体   繁体   English

不断收到“Exchange Web 服务当前不可用于此请求,因为”错误?

[英]Keep getting "Exchange Web Services are not currently available for this request because" error?

We have an application that logs in as an exchange user and does simple tasks like delete / saves / sends emails etc. I'm seeing a lot of two errors in our Splunk report:我们有一个应用程序以交换用户身份登录并执行简单的任务,例如删除/保存/发送电子邮件等。我在 Splunk 报告中看到很多两个错误:

"Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process the request" “Exchange Web 服务当前不可用于此请求,因为目标站点中的任何客户端访问服务器都无法处理该请求”

and

"Problem deleting email [ item id: (item ID string) ] - The specified object was not found in the store., The process failed to get the correct properties." “删除电子邮件时出现问题 [项目 ID:(项目 ID 字符串)] - 在商店中找不到指定的对象。,该过程未能获得正确的属性。”

I've read that it's important to include: service.HttpHeaders.Add("X-AnchorMailbox", MailboxToAccess);我已经读过包含以下内容很重要: service.HttpHeaders.Add("X-AnchorMailbox", MailboxToAccess); when impersonating users and that that may be the issue, but what about when you are just logging in as a user?当冒充用户时,这可能是问题所在,但是当您只是以用户身份登录时呢?

Here's the code where we set up the exchange service:这是我们设置交换服务的代码:

    public ExchangeServiceClient(ILog logger, IContentTypeHelper contentTypeHelper)
    {
        _logger = logger;
        _contentTypeHelper = contentTypeHelper;

        if (EvidenceSettings.Default.AppEmailUserName.Equals("Windows Credentials", StringComparison.OrdinalIgnoreCase))
        {
            _exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
            _exchangeService.Url = new Uri(PartnerEvidenceSettings.Default.ExchangeServiceAddress);
        }
        else
        {
            _exchangeService = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
            _exchangeService.Url = new Uri(EvidenceSettings.Default.ExchangeServiceAddress);
            _exchangeService.Credentials = new WebCredentials(EvidenceSettings.Default.AppEmailUserName, EvidenceSettings.Default.AppEmailPassword);
            _exchangeService.TraceEnabled = true;
            _exchangeService.UseDefaultCredentials = false;
        }
    }

And here's an example of when we use the service (just a single example, but all pretty similar functions):这是我们何时使用该服务的示例(只是一个示例,但所有功能都非常相似):

    public void DeleteMailMessage(string identifier)
    {
        // If this email was an attachment in another email, then only delete the container email
        if (identifier != null)
        {
            try
            {
                var ids = new[] { new ItemId(identifier) };
                var responseCollection = _exchangeService.DeleteItems(ids, DeleteMode.MoveToDeletedItems, null, null);
                foreach (var response in responseCollection)
                {
                    if (response.Result == ServiceResult.Error)
                    {
                        _logger.Error($"Problem deleting email [ item id: {identifier} ] - {response.ErrorMessage}");
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error($"Error deleting email [ item id: {identifier} ]", ex);
            }
        }
    }

My question is, do we need to be including the HTTPHEADERS, or is something else causing this issue?我的问题是,我们是否需要包含 HTTPHEADERS,还是其他原因导致了这个问题? If it's not that, I'm not quite sure what could be causing this error.如果不是这样,我不太确定可能导致此错误的原因。

Those two error are different and generally not related这两个错误是不同的,通常没有关系

"Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process the request" “Exchange Web 服务当前不可用于此请求,因为目标站点中的任何客户端访问服务器都无法处理该请求”

Generally this is a routing error so yes you should always included the X-AnchorMailbox header no matter if its impersonation or not.通常这是一个路由错误,所以是的,无论是否模拟,您都应该始终包含 X-AnchorMailbox 标头。 (Eg if you look at any Microsoft Mail client Outlook,OWA, Outlook Mobile you will always see these headers). (例如,如果您查看任何 Microsoft 邮件客户端 Outlook、OWA、Outlook Mobile,您将始终看到这些标题)。

"Problem deleting email [ item id: (item ID string) ] - The specified object was not found in the store., The process failed to get the correct properties." “删除电子邮件时出现问题 [项目 ID:(项目 ID 字符串)] - 在商店中找不到指定的对象。,该过程未能获得正确的属性。”

This is usually an Item error or permissions error eg no access to the Mailbox itself or your trying to access something like the Audit folder in the mailbox etc. It can also mean the Item in question has moved in the Mailbox.这通常是项目错误或权限错误,例如无法访问邮箱本身或您尝试访问邮箱中的审核文件夹等内容。这也可能意味着相关项目已在邮箱中移动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM