![]() |
VOOZH | about |
dotnet 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"
#:package 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 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.
Install the Microsoft.CoreWCF.Azure.StorageQueues library for .NET with NuGet:
dotnet add package Microsoft.CoreWCF.Azure.StorageQueues --prerelease
You need an Azure subscription and a Storage Account to use this package.
To create a new Storage Account, you can use the Azure portal, Azure PowerShell, or the Azure CLI. Here's an example using the Azure CLI:
az storage account create --name MyStorageAccount --resource-group MyResourceGroup --location westus --sku Standard_LRS
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();
}
To receive requests from the Azure Queue Storage service, you'll need to configure CoreWCF with the appropriate endpoint, and configure credentials. The Azure 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 property AzureQueueStorageBinding.Security.Transport.ClientCredentialType. The default authentication mechanism is Default, which uses DefaultAzureCredential.
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 in our documentation.
If you are using a different credential mechanism such as StorageSharedKeyCredential, you configure the appropriate ClientCredentialType on the binding and set the credential on an AzureServiceCredentials 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 are Sas, Token, and ConnectionString. The credentials class AzureServiceCredentials has corresponding properties to set each of these credential types.
If there are any errors receiving a message from Azure Queue Storage, the CoreWCF transport will log the details at the Debug log level. You can configure logging for the category Microsoft.CoreWCF at the Debug 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 of AzureQueueStorageBinding. If not specified, the default value of default-dead-letter-queue will be used.
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 the CoreWCF samples repository. To create a client to send messages to an Azure Storage Queue, see theMicrosoft.WCF.Azure.StorageQueues documentation.
See the Storage 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, visit cla.microsoft.com.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-beta.1 | 1,237 | 7/18/2024 |