February 5, 2019 By Carlos Santana 2 min read

What’s happening with IBM Cloud Functions and .NET Core?

I’m excited to announce that IBM Cloud Functions officially supports .NET Core 2.2 natively. Now, you can join the serverless revolution and start building cloud-native apps without worrying about scaling or infrastructure management by using Functions as a Service.

Ready to try it out?

  1. Create a C# project called `Example.`

    dotnet new classlib -n Example -lang "C#"
    cd Example/
  2. Install the Newtonsoft.Json NuGet package.

    dotnet add package Newtonsoft.Json -v 12.0.1
  3. Edit the Example/Class1.cs file.

    using System;
    using Newtonsoft.Json.Linq;namespace Example
    {
    public class Hello
    {
    public JObject Main(JObject args)
    {
    string name = "IBM Cloud";
    if (args.ContainsKey("name")) {
    name = args["name"].ToString();
    }
    JObject message = new JObject();
    message.Add("greeting", new JValue($"Hello, {name}!"));
    return (message);
    }
    }
    }
  4. Compile the code.

    dotnet publish -c Release -o out
  5. Create a .zip of the out directory.

    cd out
    zip -r -0 ../helloDotNet.zip *
    cd ..
  6. Create a web action with the IBM Cloud Functions CLI plugin by running the following command.

    ibmcloud fn action update helloDotNet helloDotNet.zip --main Example::Example.Hello::Main --kind dotnet:2.2 --web true
  7. Get the URL for the web action by running the following command.

    ibmcloud fn action get helloDotNet --url
  8. Open the URL in your browser.

How fast are .NET Core Functions?

Actions using the .NET Core runtime are very performant with an overhead similar to the fast Node.js runtime.

Here is a chart that compares the latency of a hello world Action in .NET vs. Node.js.

How do I learn more?

To see how easy it is to set up a project and compile your .NET Core Actions, check out the documentation.

More from Announcements

IBM Hybrid Cloud Mesh and Red Hat Service Interconnect: A new era of app-centric connectivity 

2 min read - To meet customer demands, applications are expected to be performing at their best at all times. Simultaneously, applications need to be flexible and cost effective, and therefore supported by an underlying infrastructure that is equally reliant, performant and secure as the applications themselves.   Easier said than done. According to EMA's 2024 Network Management Megatrends report only 42% of responding IT professionals would rate their network operations as successful.   In this era of hyper-distributed infrastructure where our users, apps, and data…

IBM named a Leader in Gartner Magic Quadrant for SIEM, for the 14th consecutive time

3 min read - Security operations is getting more complex and inefficient with too many tools, too much data and simply too much to do. According to a study done by IBM, SOC team members are only able to handle half of the alerts that they should be reviewing in a typical workday. This potentially leads to missing the important alerts that are critical to an organization's security. Thus, choosing the right SIEM solution can be transformative for security teams, helping them manage alerts…

IBM and MuleSoft expand global relationship to accelerate modernization on IBM Power 

2 min read - As companies undergo digital transformation, they rely on APIs as the backbone for providing new services and customer experiences. While APIs can simplify application development and deliver integrated solutions, IT shops must have a robust solution to effectively manage and govern them to ensure that response times and costs are kept low for all applications. Many customers use Salesforce’s MuleSoft, named a leader by Gartner® in full lifecycle API management for seven consecutive times, to manage and secure APIs across…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters