Error on partition ""

Alex Fang 230 Reputation points
2023-07-24T20:49:32.1466667+00:00

I am trying to run this sample code using my connection string, and I am encountering the following error:

Error on partition "" : MessagingError: The messaging entity 'sb://....servicebus.windows.net/

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,124 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
208 questions
{count} votes

Accepted answer
  1. LeelaRajeshSayana-MSFT 13,471 Reputation points
    2023-07-25T00:50:34.87+00:00

    @Alex Fang Could you please let us know the steps you have followed in executing the sample from the first link you shared? The code sample needs refer to the IoT Hub shared access policy connection string to be set in Line 130 of the code. You can get the connection string value by navigating to Security Settings --> Shared Access Policies --> select service policy and get the primary connection string. Once you have this set and execute the code sample, you should be able to receive events without any issues.

    I appreciate it if you can let me know the steps you have followed to execute the second sample as well. Seeing that you are trying to receive events from built in end point, you need to provide the connection string of your IoT Hub built in end point on Line 38 You can get the connection string value by navigating to Built-in endpoints section and looking under Event Hub-compatible endpoint setting. Setting this should execute the code as expected. Here is the response I get from the code

    User's image

    I also did not notice any part of the provided sample where partition key for the end point is accessed explicitly. I am not sure why you are facing this error. I appreciate if you can share more details on the error or any error stack to help us better understand this issue.

    Issue:

    The Default end point URL is generated from the connection string is not the same as the End point URL noticed from the portal.

    Resolution:

    Modified the code to ensure that the Entity path in the Line 113 is correct and the end point URL matches the connection string observed on the Azure portal built-in end point connection string.


    If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.


0 additional answers

Sort by: Most helpful