question

GaryFuhr-5223 avatar image
0 Votes"
GaryFuhr-5223 asked GaryFuhr-5223 answered

SmptClient.Send throws "Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)"

Unable to send email from within an ASP.NET webform application in dev environment. Working fine in Test & Production.

The following line of code:
smptClient.Send(message)

Generates this exception:
"Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)"

I've tried everything I can find on the web and in this forum, but still get the exception.

Anyone know how to resolve this? Using .Net Framework 4.7.2 and latest version of Windows 10 with all updates as of June 8, 2021.

TIA, Gary.

dotnet-aspnet-webforms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Tried with another ASP.NET webform application on both VS2017 & VS2019. SmptClient.Send(message) is working properly.

Thus, it must be something related to just the 1 application. The 1 working is under SVN. The 1 not working is under Git.

Well, ruled that out. Since converted to SVN to Git a month ago, went back to SVN project and tried to send email ... same exception.

Thought it might be something in the obj folders. Deleted all the obj folders in all 16 projects ... still get exception.

Deleted all those exact dlls VS puts in the bin folder (ie. VisualStudio.*) ... still get exception.

Running out of ideas.

0 Votes 0 ·

1 Answer

GaryFuhr-5223 avatar image
0 Votes"
GaryFuhr-5223 answered

Not sure what's wrong with SmtpClient.Send(message). Just bugs me when something that's worked for years just stops working for no obvious reason.

Decided to find a replacement. Changed our send email class to use MailKit. Works like a charm now.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.