.net 已添加具有相同密钥的项。密钥:Dlt/1942\n

.net 已添加具有相同密钥的项。密钥:Dlt/1942\n,.net,.net-core,.net,.net Core,net核心控制台应用程序,其中读取我的0365收件箱。当应用程序使用我下面的代码读取附件(电子邮件为attachment.e.eml或.msg)时,当我在windows server上托管它时,它工作正常,但当我部署在LINUX server上时,相同的代码不工作,它会给出一个错误,因为“已添加具有相同密钥的项。密钥:Dlt/1942\n 在System.Collections.Generic.Dictionary`2.TryInsert(TKey、TValue、InsertionBehavio

net核心控制台应用程序,其中读取我的0365收件箱。当应用程序使用我下面的代码读取附件(电子邮件为attachment.e.eml或.msg)时,当我在windows server上托管它时,它工作正常,但当我部署在LINUX server上时,相同的代码不工作,它会给出一个错误,因为“已添加具有相同密钥的项。密钥:Dlt/1942\n
在System.Collections.Generic.Dictionary`2.TryInsert(TKey、TValue、InsertionBehavior)”

代码行中出现错误:

itemAttachment.Load(new PropertySet(ItemSchema.MimeContent));
这是我的密码:

 foreach (Microsoft.Exchange.WebServices.Data.Attachment attachment in message.Attachments)
{
    byte[] bytearrayMailAsAttachmnet = null;
    string fileExtn = null;
    attachment.Load();
    string fileName = Convert.ToString(attachment.Name);
    if (attachment.Name.LastIndexOf(".") > 0)
    {
        fileExtn = attachment.Name.Substring((attachment.Name.LastIndexOf(".")));
    }
    if (attachment is FileAttachment)
    {
        FileAttachment fileAttachment = attachment as FileAttachment;
        bytearrayMailAsAttachmnet = fileAttachment.Content;
        fileExtn = fileExtn ?? ".pdf";
        FileAttachment fileAttachment1 = message.Attachments[0] as FileAttachment;
    }

    if (attachment is ItemAttachment)
    {
        if (fileExtn == ".") { fileExtn = null; }
        ItemAttachment itemAttachment = attachment as ItemAttachment;
        
        ConsLogger.WriteTrace("InsertMailData() @Line 493 :: ", false);
        //itemAttachment.Load(ItemSchema.MimeContent);
        itemAttachment.Load(new PropertySet(ItemSchema.MimeContent));
        ConsLogger.WriteTrace("InsertMailData() @Line 495 :: ", false);
        //itemAttachment.Load(EmailMessageSchema.MimeContent);
        bytearrayMailAsAttachmnet = itemAttachment.Item.MimeContent.Content;
        ConsLogger.WriteTrace("InsertMailData() @Line 496 :: "+ itemAttachment.Item.MimeContent.Content, false);
        fileExtn = fileExtn ?? ".eml";
    }
    if (fileExtn == ".eml") { fileName = fileName + fileExtn; }
    //string attachmentInsertStatus = Class1.InsertMailAttachment(MailID, MailTo, FileName, MailAttachment, FileExtn, "Attachment", strAliasID, strTeamID);
    DateTime dd = DateTime.Now;
    string dateString1 = dd.ToString("yyyyMMddHHmmss");
    LambdaFileModel objLFM = new LambdaFileModel();
    objLFM.bucketName = config.bucketName; //Specify your bucketname

    objLFM.s3FileName = dateString1 + "_" + RemoveSplCharfromFilename(fileName); //Specify the key name of the file to be stored in S3 without extension
                                                                                 // objLFM.bucketRegion = bucketRegion;
    objLFM.ContentType = attachment.ContentType;//Here customFile is an object of Type IFormFile

    objLFM.InputStream = bytearrayMailAsAttachmnet;// s3.ReadStream(responseStream);

    objLFM.FileExtension = fileExtn;

    string strParametersL = JsonConvert.SerializeObject(objLFM);
    LambdaFileUpload objLFU = new LambdaFileUpload();
    var res1 = objLFU.WritingAnObjectAsync(objLFM);
    string strResponseL = res1.Result.ToString();
    ConsLogger.WriteTrace("InsertMailData() @Line 509 :: " + "_" + Convert.ToString(row["interactionid"]), false);
    //MicroServices_Req_Res res = new MicroServices_Req_Res();

    //string strResponseL = res.PostJsonMicroServicesResponse(config.Lambdaurl, strParametersL, "", "");
}
几天来我一直在做零运气的事情,最后我以为我来了。任何帮助都将不胜感激