Using Cloudflare Workers with C#


i am currently trying to move my project to cloudflare workers, but i strugle, because cloudflare doesn’t support C# native? But why, it also supports F#, Kotlin, Python and C? I would need to have a solid productions solutions, the already answered questions are not a useable, for a solid backend, or are using third party programming lang. like rust. Also i don’t think a solid productions backend should have things like that.

I already saw that Microsoft Azure is capable of doing handling c# headless, so there must be a way.

Maybe you already managed to build something like that working or know how to do it, would be great!


I’d love .NET being an available language; however, languages with a JIT are typically not as popular because they have a higher startup time, our company typically works with .NET, but when it comes to edge cloud platforms, we tend to choose Python or JS because they serve excellent startup times and overall performance.

1 Like

Cloudflare Workers use the V8 JavaScript engine. All of the languages mentioned above are either compiled into WASM or transpiled into JavaScript - they do not run natively on Workers. You can read more about it here:

I already figured that out, the most lang. like php doesn’t support native, they get converted into javascript and then they can be runned, but why not java and c#?

Ahh, sorry, I misunderstood your question then :slightly_smiling_face: You can compile Java and C# to WASM and run it on Workers, but I don’t think Cloudflare has an easy-to-use template for it. I would recommend taking a look at this list to get started: GitHub - appcypher/awesome-wasm-langs: 😎 A curated list of languages that compile directly to or have their VMs in WebAssembly.

Thanks, yea i already see that link, i also converted my first c# project to wasm. And it works on the normal web. But how do i use cloudflare functions to get headers, ect in c#? In python it shows this:

def handleRequest(request):
    return __new__(Response('Python Worker hello world!', {
        'headers' : { 'content-type' : 'text/plain' }

addEventListener('fetch', (lambda event: event.respondWith(handleRequest(event.request))))

but in c# i dont have a addEventListener with fetch by default. I could create a handleRequest function, but would it worked like that? How should the main class be named? This are the questions i can’t figure out.