How to debug this remote event receiver locally in visual studio.

Deepak chauhan 1 Reputation point
2022-08-31T05:49:23.58+00:00

Hi All,

We have SharePoint online remote event receiver which is deployed on Azure web app.

Could you please suggest us how we can debug this remote event receiver locally in visual studio.

Thanks you in Advance !!

Regards,
Deepak Chauhan

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,873 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,719 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,578 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,121 Reputation points
    2022-08-31T07:08:27.07+00:00

    Hi @Deepak chauhan ,

    According to my research and testing, you can follow these steps to create a remote event receiver project and run and test event handler debugging.

    Please refer to this document: Debug and troubleshoot a remote event receiver in a SharePoint Add-in

    To create a remote event receiver project :

    1. In Visual Studio, create a provider-hosted SharePoint Add-in. See Get started creating provider-hosted SharePoint Add-ins.
    2. In Solution Explorer, select the add-in project's node.
    3. On the menu bar, select Project > Add New Item.
    4. In the Templates pane, select the List template, and then select Add.
    5. Select Finish to add a default custom list to the add-in project.
    6. Add another item to the add-in project by selecting the Remote Event Receiver template in the Templates pane.
    7. In the Name box, leave the default name (RemoteEventReceiver1), and then select Add.
    8. In the What type of event receiver do you want? list, select List Item Events. Leave the event source as List1, the list that you added in the previous steps.
    9. In the Handle the following events list, select An item is being added, and then select Finish.
      A web service is added to the web application to handle the remote event that you specified. A remote event receiver is added to the SharePoint Add-in. The receiver references the web service and the list item event in the event receiver's Elements.xml file.
    10. In the add-in project, open AppManifest.xml.
    11. Change the start page to the list's page: AddInProjectName/Lists/List1.
    12. Replace AddInProjectName with the name of your add-in project, such as SharePointAddIn4/Lists/List1. For this example, we're setting the start page to the list's page. However, in a typical add-in, you'd likely point to your own UI on the web project page.

    To run and test event handler debugging:

    1. If you haven't done so already, complete the To configure the SharePoint Add-in project in Visual Studio procedure earlier in this article.
    2. In the web project, open the remote event receiver service (RemoteEventReceiver1.svc), and then add a breakpoint to any line of code inside the ProcessEvent() method.
    3. Select the F5 key to run the project.
    4. Select the + New item button to add an item to the list.
    5. Provide a title for the item, and then select Save. The breakpoint that you added to the remote event receiver is hit, verifying that you're debugging the remote event receiver.
    6. Select the F5 key to continue to run the project, and then stop debugging when you're done.

    ------------------------------------------------------------------------
    UPDATE------------------------------------------------------------------------
    You can refer to this document : How to Debug Azure App Services Using Remote Debugging in Visual Studio

    Hope it can help you. Thanks for your understanding and support.

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



  2. Deepak chauhan 1 Reputation point
    2022-08-31T11:56:00.877+00:00

    Hi Tong Zhang,

    Thank you for your explanation !!

    Our Remote event receiver is deployed on azure web app and when we are trying to debug the solution locally it's showing error.

    Could you please suggest us how we can debug this remote event receiver locally in visual studio.

    Thanks & Regards,
    Deepak Chauhan