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:
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.
I set this, and republished. My app worked immediately.
- Check that the assemblies you expect really are deployed
- Learn more about Azure diagnostics. There must have been something screaming that an assembly wasn’t found, but it was completely opaque to me.