Azure 函数调用本机 C++ [英] Azure functions calling onto native C++
问题描述
我正在 Azure 中设计一个新架构.它是一个多租户 SaaS 应用程序,具有 ASP.NET MVC 前端和一些在 blob 存储中的应用程序特定数据.我需要在某些点对此应用程序数据执行一些后台处理.这目前只能使用一些遗留的 C++ 代码(我无法用 C# 重写).
I'm designing a new architecture in Azure. It's a multi-tenant SaaS application with an ASP.NET MVC front end and some application specific data in blob storage. I need to perform some background processing on this application data at certain points. This is currently only possible using some legacy C++ code (I can't realistically rewrite this in C#).
我的一个想法是将任何后台作业推送到队列中,并在作业被推送到队列时使用 Azure 函数为队列提供服务.症结在于本机代码.我当然可以在 C# 可以 p/invoke 的本机代码中公开方法,但是 Azure 函数可以调用本机 DLL,如果是这样,这是一种明智的方法吗?
One thought I had was to push any background jobs onto a queue and use Azure functions to service the queue as and when a job gets pushed onto it. The sticking point is the native code. I can certainly expose methods in the native code that C# can p/invoke, but can Azure functions call onto native DLLs and if so is this a sensible approach?
推荐答案
代码确实在沙箱中运行,但这种方法应该可行.(您可能需要考虑在托管程序集中公开相关 API,然后由您的函数使用).
The code does run in a sandbox, but this approach should work. (you may want to consider exposing the relevant API in a managed assembly that would in turn be consumed by your function).
您是否会遇到沙箱限制取决于您的代码在做什么,但您可以在此处了解有关沙箱及其限制的更多信息:https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox
Whether you'll run into limitations with the sandbox is dependent on what your code is doing, but you can learn more about the sandbox and its restrictions here: https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox
我希望这会有所帮助!
这篇关于Azure 函数调用本机 C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!