Failed to send test message. Error: {"error":{"code":"BadRequest","message":"WNS type is required (Parameter 'RequestHeaders')

Hi
I'm moving on documentation
I went through all the steps and successfully won the console in my c# application
After a lot of tests i started to get an error
Failed to send test message. Error: {"error":{"code":"BadRequest","message":"WNS type is required (Parameter 'RequestHeaders').TrackingId:ef9597e6-1088-4f8d-9efc-17fc6fb12008,TimeStamp:3/1/2023 6:01:06 AM +00:00"}}.
Sending via azure web interface
Platform: windows
Send to Tag Expression: -
Notification Type: Toast
Payload:
<?xml version="1.0" encoding="utf-8"?>
<toast>
<visual><binding template="ToastText01">
<text id="1">Test message</text>
</binding>
</visual>
</toast>
hi, i get this error in portal portal.azure.com

And all my attempts to send a push through Rest api
run into 403 error (but here I could be wrong)
@sem thanks for the additional info. This issue requires deeper investigation, so we feel it would be best to offer you a free technical support ticket so you can work one on one with support engineer.
Can you please email me at azcommunity@microsoft.com with the subject ATTN: Grace and in the body of the email, include your Azure subscription ID and a link to this thread?
We look forward to hearing from you.
Thanks,
Grace
@Grmacjon-MSFT sent a letter
Got same error, did you find any solution?
same here - it's quite annoying
Sign in to comment
1 answer
Sort by: Most helpful
I was facing same issue but finally make it work. i'm using Maui App but test it on Universal Windows App and it worked too.
follow these steps, if your setup of the notification hub is successful, it may help:
1- In the OnLaunched() add these lines:
make sure that the connection string is the listener connection string not the full access CS.
optionally you can add tags to send to while registering the channel uri with CreateWindowsNativeRegistrationAsync(channelUri, new { array of tags })
2- Add the Notification received handler:
3- Run the app, and test to send notification, without tags or to tags you already register them.
for this to work you need to correctly sign your application by right click the project and "Publish...".
The 403 code is caused by incorrect signature of your app or from invalid access token that you have to request to send push to a specific channel or tag. by using your Client Security Key (O~....) and the Package SID (ms-app://S-....)
hope this help
Sign in to comment