My Remote Event Receiver works in Debug, but not when published

Okay, I had exactly this issue – that my SharePoint App supporting my Remote Event Receivers would work when run under an F5 – debug deploy, but not when published properly. Annoyingly, I’ve found that I have to make a number of changes when moving between a ‘proper’ build, and an F5-deploy; I’ve mentioned those before, but they were turning off the AppUninstalling event, and replacing the ClientId in the app manifest with a *.

However, I’d checked these things, and my code still didn’t work.

Configuration settings were the same for debug and release deployments. I figured that the issue was with how I was deploying the released .app file, but Googling showed me lots of instructions the same as what I did.

Next, I turned on all the diagnostics I could find in Azure. Now, I’ll admit, I’ve not done too much with Azure, particularly with the diagnostics end of things, but I really couldn’t find much more than the IIS logs, which showed that requests to my remote event receiver were being received, and a HTTP 202 response was being sent. I had to look up what that meant. But I couldn’t see any big errors, stack traces, etc.. Clearly, I need to spend some more time looking into this.

Out of desperation, I began to wonder what else might be wrong. I’m using SendGrid in my receivers, and I wondered if the SendGridPlus.dll hadn’t been deployed. I used FTP to check the files in my website’s /bin directory:

FTP view of BIN

Ah ha! It’s there, but the Microsoft.SharePoint.Client.Taxonomy.dll that I also need in my solution was not. I returned to Visual Studio and checked the reference. I found that the reference’s ‘Copy Local’ setting was False. This needed to be true.

Reference Properties

I set this, and republished. My app worked immediately.

Lessons:

  1. Check that the assemblies you expect really are deployed
  2. Learn more about Azure diagnostics. There must have been something screaming that an assembly wasn’t found, but it was completely opaque to me.
Advertisement
My Remote Event Receiver works in Debug, but not when published

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.