0

public async Task Run([ServiceBusTrigger("testqueue",, Connection = "queueConn")]string mySbMsg, ILogger log) { try {

/////////// message is not even hitting the function. however it is failing with the below error message. /////// System.Private.CoreLib: Exception while executing function: ExportInspection. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'mySbMsg'. Microsoft.Azure.WebJobs.ServiceBus: The Message with ContentType 'null' failed to deserialize to a string with the message: 'Expecting element 'string' from namespace 'http://schemas.microsoft.com/2003/10/Serialization/'.. Encountered 'Element' with name 'base64Binary', namespace 'http://schemas.microsoft.com/2003/10/Serialization/'.'. System.Private.DataContractSerialization: Expecting element 'string' from namespace 'http://schemas.microsoft.com/2003/10/Serialization/'.. Encountered 'Element' with name 'base64Binary', namespace 'http://schemas.microsoft.com/2003/10/Serialization/'.

why is the content type null and how to resolve this issue

  • This could be an indication that 1. Function is not activated 2. And may be it is not activated while a message is found on the queue 3. Check your function configuration – SaiSakethGuduru Jan 25 '22 at 15:01
  • Also for serialization error check this action Item https://i.imgur.com/DonRC6M.png – SaiSakethGuduru Jan 25 '22 at 15:03
  • 1
    What's your incoming message looks like? Have you analyzed it? Who's sending the message? Is it sent by the same Service Bus SDK or not? Share those details as they matter. I have a strong feeling you're trying to process a legacy formatted message with a newer Functions SDK that is using the latest ASB SDK. "message is not even hitting the function" - then this is not NServiceBus related. Please remove `nservicebus` tag. – Sean Feldman Jan 25 '22 at 17:46
  • SeanFeldman the message is sent from nservicebus v7 client. below is the incoming message @base64Binary3http://schemas.microsoft.com/2003/10/Serialization/�'{"InspectionId":1289411387,"Type":1} – user18027665 Jan 26 '22 at 19:57
  • Try UTF8 encoding in the message –  Jan 29 '22 at 13:21

0 Answers0