Using Azure Service Bus Shared Access Signature with NetMessagingBinding in WCF

I Googled, Binged, and scoured internet and various documentation and could not find this setting.  I was able to reverse engineer the declarative markup based on the properties in the classes and code samples.

If you want to use the shared access signature authentication with the netMessagingBinding in WCF declaratively in your web.config or app.config, here's how....

Given the service bus connection string....

Endpoint=sb://acme.servicebus.windows.net/;SharedAccessKeyName=efudd;SharedAccessKey=f9JFgRYdLdnPTQv4/EC5ixt4iHVUSTCnhOg1uep9lsW=

The configuration for your transportClientEndpointBehavior looks like this...

<transportClientEndpointBehavior>
    <tokenProvider>
        <sharedAccessSignature keyName="efudd" key="f9JFgRYdLdnPTQv4/EC5ixt4iHVUSTCnhOg1uep9lsW=" />              
    </tokenProvider>
</transportClientEndpointBehavior>

Happy Coding!

Comments

Popular posts from this blog

Code Coverage for Multiple Projects in a Single Build using Dotnet Test and Coverlet

Using NHibernate in Asp.Net Core

Incorporating Snyk into Continuous Integration with Azure Yaml Pipelines