> mobileapp Strategy - From Idea to Mobile App RealityVinova Our team will brainstorm with you on where to begin, where to go, and how to get you there. Whether you have a spark of an idea or an existing app – we can help. Getting your mobile strategy right is what our unique services are all about. We’ll wrestle with business challenges, discover new opportunities that will help you define and refine your product ideas into mobile app reality.

CoreWCF 1.0 has been Released, WCF for .NET Core and .NET 5+

CoreWCF 1.0 has been Released, WCF for .NET Core and .NET 5+

The CoreWCF Project team has released the 1.0 version of CoreWCF, a port of WCF to the .NET Core platform. It provides a compatible implementation of SOAP, NetTCP, and WSDL. Usage in code is similar to WCF, but updated to use ASP.NET Core as the service host, and to work with .NET Core. This is the first major release of the project, and provides WCF functionality for .NET Core, .NET Framework, and .NET 5+.

The 1.0 release of CoreWCF is compatible with .NET Standard 2.0 so that it will work with:

  • .NET Framework 4.6.2 (and above)
  • .NET Core 3.1
  • .NET 5 & 6

Support for .NET Framework will enable an easier modernization path to .NET Core. Applications with WCF dependencies can be updated to use CoreWCF in-place on .NET framework, which then will work the same when updated to use .NET Core or .NET 5+.

The assemblies are available on Nuget.org, as described in the Release Notes.

Community Project

CoreWCF was announced as a community project in June of 2019, and has had many contributors during the last 3 years. As a community project, CoreWCF has had more commits from other contributors than Microsoft employees, and regular contributions from AWS and other organizations.

A special thanks to all those who have contributed code, issues or suggestions. The community support has been critical to getting the project to this point, and we hope it will continue for subsequent versions. I’d be remiss if I didn’t make a special callout to @mconnew who has been the backbone of the project and contributed most of the code.

As a community project, the voices of the community guide the direction of the project. For example, the Feature Roadmap Vote issue is highly influential to the planning process for what to work on next. If you are a WCF user, please provide feedback on what you would like to see in subsequent releases.

Features

CoreWCF is a subset of the functionality from WCF, but represents what we believe are the most used features, including:

  • Http & NetTCP transports
  • Bindings:
    • BasicHttpBinding
    • NetHttpBinding
    • NetTcpBinding – some WS-* features not supported
    • WebHttpBinding
    • WSHttpBinding – some WS-* features not supported
  • Security:
    • Transport
    • NetTcpBinding supports Certificate and Windows authentication
    • Http bindings require authentication to be configured in ASP.NET Core
    • Transport With Message Credentials
    • Username, Certificate and Windows Authentication are supported
    • WS Federation
  • WSDL generation
  • Partial configuration support including services & endpoints
  • Extensibility (IServiceBehavior and IEndpointBehavior) – most extensibility is available

Major WCF features not yet implemented include:

  • Transports other than Http and NetTCP.
  • Message security beyond Transport & Transport with Message Credentials
  • Distributed transactions
  • Message Queueing

Who should use CoreWCF?

CoreWCF is intended for customers who have been using WCF on .NET Framework and need WCF support in .NET Core to facilitate modernizing the application. While there is nothing stopping you from adopting CoreWCF in greenfield projects, we would recommend you consider more modern alternatives to SOAP such as gRPC. The sweet spot for CoreWCF is to make it easier to modernize server and clients that have a strong dependency on WCF and SOAP.

Microsoft Support

We recognize how important support is to enterprise customers, and so we are pleased to announce that Microsoft Product Support will be available for CoreWCF customers.

Support for CoreWCF 1.x will depend on the support status for the underlying .NET platforms it runs on.

Runtime Version Support dependency duration
.NET Framework 4.x The specific version of .NET Framework, and ASP.NET Core 2.1.
.NET Core 3.1 .NET 3.1 LTS – December 3, 2022
.NET 5 .NET 5 – May 8, 2022
.NET 6 .NET 6 LTS – November 8, 2024

CoreWCF will use Major.Minor versioning strategy:

  • 1.0 will be the first major release of CoreWCF
  • Minor releases will be numbered 1.x, and will have the same underlying platform requirements as 1.0.
  • Minor version releases (1.x) will be API compatible with the 1.0 release.
  • Support will be primarily for the latest major.minor release of each supported major version.
    • When new major or minor versions are released, then the previous release will be supported for 6 months from the date of the new release, provided the underlying runtime dependency being used is still within support.
  • Subsequent major versions, such as 2.0, may reduce the map of runtimes that are supported. In that case 1.x will continue to be supported beyond the 6 months on the runtimes that are not supported by 2.0, and support duration will be limited only by the underlying platform.
    • This will most likely apply to .NET Framework, and means that 1.x will be supported as long as both ASP.NET Core 2.1 and .NET Framework 4.x are under support.

Other organizations/companies may choose to provide support for CoreWCF in conjunction with the use of their products and services.

Getting started

The definition and implementation of data and service contracts is the same as WCF. The major difference is in the definition of the host which is now based on ASP.NET Core, and the ceremony of how a service is exposed. The following is based on .NET 6, but the same steps apply to other versions of .NET.

Defining the service

1. Create an ASP.NET Core Empty application, this provides the host for the service.

Visual Studio:
Project Template

Command Line:

mkdir CoreWCFDemoServer
dotnet new web -n CoreWCFDemoServer -o CoreWCFDemoServer

2. Add references to the CoreWCF Nuget Packages

Visual Studio:

Using the package Manager console, add:

  • Primitives
  • Http

Command Line:

Edit the project file and add:

<ItemGroup>
  <PackageReference Include="CoreWCF.Http" Version="1.0.0" />
  <PackageReference Include="CoreWCF.Primitives" Version="1.0.0" />
</ItemGroup>

3. Create the Service Contract and Data Contract definitions

These are defined the same as with WCF. When modernizing projects, this code can remain largely unchanged.

File: IEchoService.cs

using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
using CoreWCF;

namespace CoreWCfDemoServer
{
    [DataContract]
    public class EchoFault
    {
        [AllowNull]
        private string _text;

        [DataMember]
        [AllowNull]
        public string Text
        {
            get { return _text; }
            set { _text = value; }
        }
    }

    [ServiceContract]
    public interface IEchoService
    {
        [OperationContract]
        string Echo(string text);

        [OperationContract]
        string ComplexEcho(EchoMessage text);

        [OperationContract]
        [FaultContract(typeof(EchoFault))]
        string FailEcho(string text);

    }

    [DataContract]
    public class EchoMessage
    {
        [AllowNull]
        [DataMember]
        public string Text { get; set; }
    }
}

File: EchoService.cs

using CoreWCF;

namespace CoreWCfDemoServer
{
    public class EchoService : IEchoService
    {
        public string Echo(string text)
        {
            System.Console.WriteLine($"Received {text} from client!");
            return text;
        }

        public string ComplexEcho(EchoMessage text)
        {
            System.Console.WriteLine($"Received {text.Text} from client!");
            return text.Text;
        }

        public string FailEcho(string text)
            => throw new FaultException<EchoFault>(new EchoFault() { Text = "WCF Fault OK" }, new FaultReason("FailReason"));

    }
}

4. The Service host needs to be told which services to expose via which bindings.

Update Program.cs to expose the Bindings:

using CoreWCF;
using CoreWCF.Configuration;
using CoreWCF.Description;
using CoreWCfDemoServer;

var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel((context, options) =>
{
options.AllowSynchronousIO = true;
});

// Add WSDL support
builder.Services.AddServiceModelServices().AddServiceModelMetadata();
builder.Services.AddSingleton<IServiceBehavior, UseRequestHeadersForMetadataAddressBehavior>();

var app = builder.Build();
app.UseServiceModel(builder =>
{
builder.AddService((serviceOptions) => { })
// Add a BasicHttpBinding at a specific endpoint
.AddServiceEndpoint<EchoService, IEchoService>(new BasicHttpBinding(), "/EchoService/basichttp")
// Add a WSHttpBinding with Transport Security for TLS
.AddServiceEndpoint<EchoService, IEchoService>(new WSHttpBinding(SecurityMode.Transport), "/EchoService/WSHttps");
});
var serviceMetadataBehavior = app.Services.GetRequiredService();
serviceMetadataBehavior.HttpGetEnabled = true;

app.Run();

5. Update the appsettings.json to specify fixed ports for the service to listen on

Add the following line before the “Logging” line in appsettings.json:

"Urls": "http://localhost:5000;https://localhost:5001",

6. Run the project so that the services can be called

To consume the service:

1. Create a console application

2. Add a Service Reference

Visual Studio

Use the “Add Service Reference” command, and select “WCF Web Service” as the service type.

Use http://localhost:5000/EchoService/basichttp as the URL for WSDL discovery.

Command line

From the Command Line, the same code can be generated using svcutil:

dotnet tool install --global dotnet-svcutil
dotnet-svcutil --roll-forward LatestMajor http://localhost:5000/EchoService/basichttp?wsdl

3. Replace the code of the console app with:

using ServiceReference1;
// Instantiate the Service wrapper specifying the binding and optionally the Endpoint URL. The BasicHttpBinding could be used instead.
var client = new EchoServiceClient(EchoServiceClient.EndpointConfiguration.WSHttpBinding_IEchoService, "https://localhost:5001/EchoService/WSHttps");

var simpleResult = await client.EchoAsync("Hello");
Console.WriteLine(simpleResult);

var msg = new EchoMessage() { Text = "Hello2" };
var msgResult = await client.ComplexEchoAsync(msg);
Console.WriteLine(msgResult);

Other Samples

Other samples, including samples for desktop framework are available at CoreWCF/src/Samples

See it in action

On an recent episode of On .NET, Matthew Connew joined James Montemagno to walk through all of the new features and roadmap for CoreWCF:

Summary

We are pleased to see the community investment in the CoreWCF project, and congratulate them on this release. The project is ongoing and they welcome your feedback via and in GitHub, in particular which features you think should be worked on next.

The post CoreWCF 1.0 has been Released, WCF for .NET Core and .NET 5+ appeared first on .NET Blog.

This content was originally published here.

Malcare WordPress Security

singapore mobile app developer,android developer singapore,singapore app developer,web development singapore,mobile application developer singapore,web development company singapore,app development singapore,developer in singapore,mobile developer singapore,singapore mobile application developer,mobile game developer singapore,ios developer singapore,mobile apps singapore,design agency singapore,website designer singapore,mobile application development singapore,web application singapore,mobile app developer singapore,singapore website design,mobile apps development singapore,mobile app development singapore,website design singapore,graphic designer in singapore,singapore web design services,website development singapore,web designer singapore,singapore web design,web design company singapore,web design singapore,singapore web development,app developer singapore,website developer singapore,developers in singapore,ruby on rails developer singapore,web design services singapore,design firms in singapore,ios app development singapore