Microsoft.CoreWCF.Azure.StorageQueues 1.0.0-beta.1
Prefix Reserveddotnet add package Microsoft.CoreWCF.Azure.StorageQueues --version 1.0.0-beta.1
NuGet\Install-Package Microsoft.CoreWCF.Azure.StorageQueues -Version 1.0.0-beta.1
<PackageReference Include="Microsoft.CoreWCF.Azure.StorageQueues" Version="1.0.0-beta.1" />
<PackageVersion Include="Microsoft.CoreWCF.Azure.StorageQueues" Version="1.0.0-beta.1" />Directory.Packages.props
<PackageReference Include="Microsoft.CoreWCF.Azure.StorageQueues" />Project file
paket add Microsoft.CoreWCF.Azure.StorageQueues --version 1.0.0-beta.1
#r "nuget: Microsoft.CoreWCF.Azure.StorageQueues, 1.0.0-beta.1"
#addin nuget:?package=Microsoft.CoreWCF.Azure.StorageQueues&version=1.0.0-beta.1&prereleaseInstall as a Cake Addin
#tool nuget:?package=Microsoft.CoreWCF.Azure.StorageQueues&version=1.0.0-beta.1&prereleaseInstall as a Cake Tool
CoreWCF Azure Queue Storage library for .NET
CoreWCF Azure Queue Storage is the service side library that will help existing WCF services to be able to use Azure Queue Storage to communicate with clients as a modern replacement to using MSMQ.
Getting started
Install the package
Install the Microsoft.CoreWCF.Azure.StorageQueues library for .NET withNuGet:
dotnet add package Microsoft.CoreWCF.Azure.StorageQueues --prerelease
Prerequisites
You need anAzure subscription and aStorage Account to use this package.
To create a new Storage Account, you can use theAzure portal,Azure PowerShell, or theAzure CLI.Here's an example using the Azure CLI:
az storage account create --name MyStorageAccount --resource-group MyResourceGroup --location westus --sku Standard_LRS
Configure ASP.NET Core to use CoreWCF with Queue transports
In order to receive requests from the Azure Queue Storage service, you'll need to configure CoreWCF to use queue transports.
public void ConfigureServices(IServiceCollection services){ services.AddServiceModelServices() .AddQueueTransport();}
Authenticate the service to Azure Queue Storage
To receive requests from the Azure Queue Storage service, you'll need to configure CoreWCF with the appropriate endpoint, and configure credentials. TheAzure Identity library makes it easy to add Microsoft Entra ID support for authenticating with Azure services.
There are multiple authentication mechanisms for Azure Queue Storage. Which mechanism to use is configured via the propertyAzureQueueStorageBinding.Security.Transport.ClientCredentialType
. The default authentication mechanism isDefault
, which usesDefaultAzureCredential
.
public void Configure(IApplicationBuilder app){ app.UseServiceModel(serviceBuilder => { // Configure CoreWCF to dispatch to service type Service serviceBuilder.AddService<Service>(); // Create a binding instance to use Azure Queue Storage, passing an optional queue name for the dead letter queue // The default client credential type is Default, which uses DefaultAzureCredential var aqsBinding = new AzureQueueStorageBinding("DEADLETTERQUEUENAME"); // Add a service endpoint using the AzureQueueStorageBinding string queueEndpointString = "https://MYSTORAGEACCOUNT.queue.core.windows.net/QUEUENAME"; serviceBuilder.AddServiceEndpoint<Service, IService>(aqsBinding, queueEndpointString); });}
Learn more about enabling Microsoft Entra ID for authentication with Azure Storage inour documentation.
Other authentication credential mechanisms
If you are using a different credential mechanism such asStorageSharedKeyCredential
, you configure the appropriateClientCredentialType
on the binding and set the credential on anAzureServiceCredentials
instance via an extension method.
public void Configure(IApplicationBuilder app){ app.UseServiceModel(serviceBuilder => { // Configure CoreWCF to dispatch to service type Service serviceBuilder.AddService<Service>(); // Create a binding instance to use Azure Queue Storage, passing an optional queue name for the dead letter queue var aqsBinding = new AzureQueueStorageBinding("DEADLETTERQUEUENAME"); // Configure the client credential type to use StorageSharedKeyCredential aqsBinding.Security.Transport.ClientCredentialType = AzureClientCredentialType.StorageSharedKey; // Add a service endpoint using the AzureQueueStorageBinding string queueEndpointString = "https://MYSTORAGEACCOUNT.queue.core.windows.net/QUEUENAME"; serviceBuilder.AddServiceEndpoint<Service, IService>(aqsBinding, queueEndpointString); // Use extension method to configure CoreWCF to use AzureServiceCredentials and set the // StorageSharedKeyCredential instance. serviceBuilder.UseAzureCredentials<Service>(credentials => { credentials.StorageSharedKey = GetStorageSharedKey(); }); });}public StorageSharedKeyCredential GetStorageSharedKey(){ // Fetch shared key using a secure mechanism such as Azure Key Vault // and construct an instance of StorageSharedKeyCredential to return; return default;}
Other values for ClientCredentialType areSas
,Token
, andConnectionString
. The credentials classAzureServiceCredentials
has corresponding properties to set each of these credential types.
Troubleshooting
If there are any errors receiving a message from Azure Queue Storage, the CoreWCF transport will log the details at theDebug
log level. You can configure logging for the categoryMicrosoft.CoreWCF
at theDebug
level to see any errors.
.ConfigureLogging((logging) =>{ logging.AddFilter("Microsoft.CoreWCF", LogLevel.Debug);});
If a message was recevied from the queue, but wasn't able to be processed, it will be placed in the dead letter queue. You can sepcify the dead letter queue name by passing it to the constructor ofAzureQueueStorageBinding
. If not specified, the default value ofdefault-dead-letter-queue
will be used.
Key concepts
CoreWCF is an implementation of the service side features of Windows Communication Foundation (WCF) for .NET. The goal of this project is to enable migrating existing WCF services to .NET that are currently using MSMQ and wish to deploy their service to Azure, replacing MSMQ with Azure Queue Storage.
More general samples of using CoreWCF can be found in theCoreWCF samples repository. To create a client to send messages to an Azure Storage Queue, see theMicrosoft.WCF.Azure.StorageQueues documentation.
Contributing
See theStorage CONTRIBUTING.md for details on building,testing, and contributing to this library.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visitcla.microsoft.com.
This project has adopted theMicrosoft Open Source Code of Conduct.For more information see theCode of Conduct FAQ or contactopencode@microsoft.com with any additional questions or comments.
Product | VersionsCompatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
.NETStandard 2.0
- Azure.Identity(>= 1.12.0)
- Azure.Storage.Queues(>= 12.18.0)
- CoreWCF.Queue(>= 1.5.2 && < 2.0.0)
- System.IO.Pipelines(>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0-beta.1 | 747 | 7/18/2024 |
- Last updated7/18/2024
- Project website
- Source repository
- MIT license
- Download package (75.09 KB)
- Open in NuGet Package Explorer
Open in NuGet Trends
- Report package
© Microsoft Corporation. All rights reserved.