I am trying to create a service bus relay based on this article
I get an error message Generic: InvalidSignature: The token has an invalid signature.
static void Main(string[] args)
{
ServiceHost sh = new ServiceHost(typeof(ProblemSolver));
sh.AddServiceEndpoint(
typeof(IProblemSolver), new NetTcpBinding(),
"net.tcp://tjservicebus.servicebus.windows.net/solver");
Console.WriteLine("Add Binding End Point");
var key = "MYKEY";
sh.AddServiceEndpoint(
typeof(IProblemSolver), new NetTcpRelayBinding(),
ServiceBusEnvironment.CreateServiceUri("sb", "tjservicebus", "solver"))
.Behaviors.Add(new TransportClientEndpointBehavior
{
TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", key)
});
sh.Open();
Console.WriteLine("Press ENTER to close");
Console.ReadLine();
sh.Close();
}
The error message appears at the point of sh.Open();
Can anyone help?
I also had this error message and it turned out to be the same issue as Andy Zhang.
I deleted the service bus to test automated deployment and was still referencing the old SharedAccessKey in the connection string to connect but this had changed after redeployment.
We stored our connection string in Key Vault, so I had to change the connection string in there to resolve the issue.
I encountered the same error as your first.
But my problem is I used the connection string as the key. Then I have changed the last parameter SharedAccessKey
for the key, and the error has been resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With