CRM 2013: Email Router: The message exceeds maximum supported size

If your email router does not process any emails but your inbox from Email Provider works just fine!?! Check event logs where Email Router is installed. You might see many repeated errors similar to mentioned error here below:

#27938 – An error occurred while checking for email messages to process in mailbox service@gmail.com. Microsoft.Crm.Tools.Email.Providers.EmailException: Error: The message exceeds the maximum supported size.
at Microsoft.Crm.Tools.Email.Providers.ExchangeWSConnector.LogEwsResponseErrorWarning(String message, ResponseClassType responseClassType)
at Microsoft.Crm.Tools.Email.Providers.ExchangeWSConnector.RetrieveMessage(ArrayList ids, Int32 index, ServiceLogger serviceLogger)
at Microsoft.Crm.Tools.Email.Providers.ExchangePollingMailboxProvider.RetrieveNextMessageInternal()
at Microsoft.Crm.Tools.Email.Providers.CrmPollingMailboxProvider.RetrieveNextMessage()
at Microsoft.Crm.Tools.Email.Providers.CrmPollingMailboxProvider.Run()

Check your inbox for the emails with attachments. Find emails with more than expected attachments size per email, take backup (if required) and delete them. Your Email Router should work just fine once this is done!

In my case an email with 100+ MB attachment size was creating an issue.

Happy Troubleshooting!!

C#: Security accessibility of the overriding method must match the security accessibility of the method being overriden

I was porting a .Net 2.0 assembly to .Net 4.0 plugin assembly and faced this particular challenge.

The project had a test app(A WinForm app) and it worked fine on the desktop but when I deployed the logic on server to run as a plugin it gave the following error

xyz..GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Just notice, the spelling for “overridden” is also not correct. But this is what .Net framework threw.
After some research I found that this behavior is “By Design” i.e. as per security transparency model defined in .Net v4.0. It basically has two models:
1. Level1 (High Level) for v2.0
2. Level2 for v4.0
Here is a a list of critical operations:

1. Call native code

2. Contain unverifiable code

3. Call critical code

4. Perform security asserts

5. Satisfy link demands

6. Derive from non-transparent types

7. Override security critical virtuals

And only full trust code can be security critical.

Hence an overridden member should have the same security accessibility (Critical, Safe Critical or Transparent).
To resolve this error take the following step:
Go to the AssemblyInfo.cs class to your project and add following attributes to it. And this should resolve the exception.

[assembly: SecurityRules(SecurityRuleSet.Level1)] 
[assembly: AllowPartiallyTrustedCallers]

I believe it might be helpful to many as there are lot of Dynamics CRM implementations being upgraded.

Reference links to the differences between both and transparency rules:
http://blogs.msdn.com/b/shawnfa/archive/2009/11/12/differences-between-the-security-rule-sets.aspx
http://blogs.msdn.com/b/shawnfa/archive/2009/11/03/transparency-101-basic-transparency-rules.aspx

Hyper-V: The application encountered an error while attempting to change the state of

Hello,

I got following error while creating a new VM and booting it through a DVD drive from Hyper-V.

The application encountered an error while attempting to change the state of <Virtual Machine>. <Virtual Machine> failed to start.

Microsoft Emulated IDE Controller (Instance ID {83F8638B-8DCA-4152-9EDA-2CA8B33039B4}): Failed to Power on with Error ‘The process cannot access the file because it is being used by another process.’

Failed to open attachment ‘D:’. Error: ‘The process cannot access the file because it is being used by another process.’

Resolution:

You must be working on multiple Virtual Machines… and same DVD drive is being used by more than one Virtual Machines. Remove the DVD/Virtual Drives from other Virtual Machines and Start the VM you are working on.

Done! Voila!

AD Change Password C#: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Hi,

I was trying to Reset/Change Password for Active Directory through C# code behind. And I encountered with the same error:Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Access Denied errors that are reported by scripts and applications that access WMI namespaces and data generally fall into three categories.

Possible Reasons are:
The user does not have remote access to the computer through DCOM. Typically, DCOM errors occur when connecting to a remote computer with a different operating system versions.

Solution:
Give the user Remote Launch and Remote Activation permissions in dcomcnfg.

  • Right-click My Computer-> Properties Under COM Security, click “Edit Limits” for both sections.
  • Give the user you want remote access, remote launch, and remote activation.
  • Go to DCOM Config, find “Windows Management Instrumentation”, and give the user you want Remote Launch and Remote Activation.

For more information, see Connecting Between Different Operating Systems

References: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394603(v=vs.85).aspx

ADFS 2.0: “Could not load file or assembly ‘Microsoft.IdentityServer.Compression’ or one of its dependencies. An attempt was made to load a program with an incorrect format”

If you have come to this blog searching for the error mentioned above then probably you’re doing some modifications to ADFS 2.0 site.

Following would be the symptoms that you have done so far:

  • You have opened adfs\ls website as Website project in Visual Studio.
  • If the project type is Website, you probably had a message from Visual Studio to upgrade for the .Net v4.0.
  • You have created a new project Empty Web Application and imported adfs\ls website content to the project.
  • You are modifying this site/application on local machine and not on Windows Server where ADFS is installed.

Follow these steps to successfully start modifying ADFS site:

  1. Install Visual Studio 2010 on Windows Server where ADFS is installed and configured.
  2. Create an Empty Web Application
  3. Import all the files from adfs\ls directory to the Web Application. (generally, you can find it on c:\inetpub\adfs\ls)
  4. Right click on the project in Solution Explorer and click on “Convert to Web Application”.
  5. You’re ready to go!

You do not need to add reference of any files to this web application. Just Build and Publish the site to the same directory where adfs is installed.

Microsoft.IdentityServer.Compression and other required files will be referenced from GAC as you are developing the project on the server itself.

Happy Programming! 🙂