About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
windows_first
⚠️
missing_linux_example
⚠️
windows_tools
Summary:
The documentation is heavily oriented toward Windows development environments, specifically Visual Studio and .NET Framework. All instructions, examples, and tooling references assume a Windows platform. There are no mentions of Linux or cross-platform alternatives, and all code samples and project setup steps are tailored to Windows users. The use of Visual Studio, .NET Framework (not .NET Core/.NET 5+), and Windows-specific project types further reinforce this bias.
Recommendations:
- Provide equivalent instructions for Linux and macOS users, including using cross-platform .NET (such as .NET 6/7/8) and editors like VS Code or JetBrains Rider.
- Include command-line instructions (e.g., using dotnet CLI) for project creation, package management, and building/running applications.
- Clarify which steps are Windows-specific and offer alternatives for other platforms (e.g., running as a .NET Core console app, using cross-platform configuration files).
- Mention and demonstrate how to use Azure WCF Relay with .NET Core/.NET 5+ (which is cross-platform) and highlight any limitations or differences.
- Add troubleshooting notes for Linux users, especially around WCF support and any required dependencies.
- Consider referencing or linking to official Microsoft documentation on running WCF clients/services on non-Windows platforms.
Create pull request
Flagged Code Snippets
<?xmlversion="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<client>
</client>
</system.serviceModel>
</configuration>
using System.ServiceModel;
using System.ServiceModel;
using Microsoft.ServiceBus;
using System;
using System.ServiceModel;
namespace Microsoft.ServiceBus.Samples
{
[ServiceContract(Name = "IEchoContract", Namespace = "https://samples.microsoft.com/ServiceModel/Relay/")]
public interface IEchoContract
{
[OperationContract]
String Echo(string text);
}
public interface IEchoChannel : IEchoContract, IClientChannel { }
class Program
{
static void Main(string[] args)
{
}
}
}
<?xmlversion="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<services>
</services>
</system.serviceModel>
</configuration>
<service name="Microsoft.ServiceBus.Samples.EchoService">
</service>
[ServiceBehavior(Name = "EchoService", Namespace = "https://samples.microsoft.com/ServiceModel/Relay/")]
class EchoService : IEchoContract
{
public string Echo(string text)
{
Console.WriteLine("Echoing: {0}", text);
return text;
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="Microsoft.ServiceBus.Samples.EchoService">
<endpoint contract="Microsoft.ServiceBus.Samples.IEchoContract" binding="netTcpRelayBinding" />
</service>
</services>
<extensions>
<bindingExtensions>
<add name="netTcpRelayBinding"
type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</bindingExtensions>
</extensions>
</system.serviceModel>
</configuration>
ServiceHost host = new ServiceHost(typeof(EchoService), address);
using System.ServiceModel.Description;
using Microsoft.ServiceBus.Description;
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Description;
namespace Microsoft.ServiceBus.Samples
{
[ServiceContract(Name = "IEchoContract", Namespace = "https://samples.microsoft.com/ServiceModel/Relay/")]
public interface IEchoContract
{
[OperationContract]
String Echo(string text);
}
public interface IEchoChannel : IEchoContract, IClientChannel { };
[ServiceBehavior(Name = "EchoService", Namespace = "https://samples.microsoft.com/ServiceModel/Relay/")]
class EchoService : IEchoContract
{
public string Echo(string text)
{
Console.WriteLine("Echoing: {0}", text);
return text;
}
}
class Program
{
static void Main(string[] args)
{
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect;
Console.Write("Your Service Namespace: ");
string serviceNamespace = Console.ReadLine();
Console.Write("Your SAS key: ");
string sasKey = Console.ReadLine();
// Create the credentials object for the endpoint.
TransportClientEndpointBehavior sasCredential = new TransportClientEndpointBehavior();
sasCredential.TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", sasKey);
// Create the service URI based on the service namespace.
Uri address = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "EchoService");
// Create the service host reading the configuration.
ServiceHost host = new ServiceHost(typeof(EchoService), address);
// Create the ServiceRegistrySettings behavior for the endpoint.
IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public);
// Add the Relay credentials to all endpoints specified in configuration.
foreach (ServiceEndpoint endpoint in host.Description.Endpoints)
{
endpoint.Behaviors.Add(serviceRegistrySettings);
endpoint.Behaviors.Add(sasCredential);
}
// Open the service.
host.Open();
Console.WriteLine("Service address: " + address);
Console.WriteLine("Press [Enter] to exit");
Console.ReadLine();
// Close the service.
host.Close();
}
}
}
using System;
using Microsoft.ServiceBus;
using System.ServiceModel;
namespace Microsoft.ServiceBus.Samples
{
[ServiceContract(Name = "IEchoContract", Namespace = "https://samples.microsoft.com/ServiceModel/Relay/")]
public interface IEchoContract
{
[OperationContract]
string Echo(string text);
}
public interface IEchoChannel : IEchoContract, IClientChannel { }
class Program
{
static void Main(string[] args)
{
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint name="RelayEndpoint"
contract="Microsoft.ServiceBus.Samples.IEchoContract"
binding="netTcpRelayBinding"/>
</client>
<extensions>
<bindingExtensions>
<add name="netTcpRelayBinding"
type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</bindingExtensions>
</extensions>
</system.serviceModel>
</configuration>