none
SPEmailEventReceiver event fails with "Could not load file or assembly"

    Frage

  • I have a event that inherits from SPEmailEventReceiver and am having problems getting it to work correctly. Currently the event just overrides the EmailReceived method and just contains some simple diagnostics code I've used before in other events.

    However, despite such a simple use case this event handler is failing. What is happening is that I send an email to a discussion group in which the event is registered and the email never arrives in the discussion group, and my event is never fired. Upon digging a little deeper I found the following clue in the windows event log on my MOSS server:

    Event manager error: Could not load file or assembly 'SampleEvent, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5740d35394407a29' or one of its dependencies. The system cannot find the file specified.

    What is puzzeling about this is that the SampleEvent event is registered in the GAC, and its only depedency is .NET 2.0 and Microsoft.SharePoint.dll. I double checked, and both systems have the exact same version number and patch level of those depedencies. I have also double checked that the public key token, version and other aspects of the assembly's signature are correct.

    I am at a lose of what to check. I have seen others post similar difficulties, but I have not seen anyone discuss how to get past this issue. Any ideas?

    Thanks in advance.

    Jason
    Mittwoch, 29. Oktober 2008 13:41

Antworten

  •  I have found in these cases, you need to restart the OWSTimer service as well as IIS.  Make sure to do this on the server that has incoming email enabled (or all of them).

    It seems that OWSTimer service gets its OWN cached copy of your DLL.

    Give it a shot, and let me know.
    -DK Blog
    Mittwoch, 29. Oktober 2008 13:44

Alle Antworten

  •  I have found in these cases, you need to restart the OWSTimer service as well as IIS.  Make sure to do this on the server that has incoming email enabled (or all of them).

    It seems that OWSTimer service gets its OWN cached copy of your DLL.

    Give it a shot, and let me know.
    -DK Blog
    Mittwoch, 29. Oktober 2008 13:44
  • Thank you!

    That worked like a charm. Being just a development machine I simply rebooted the whole system for the ease of it, but once it rebooted my event is working like it should.

    Jason
    Mittwoch, 29. Oktober 2008 13:58