C# 如何将Azure函数的入口点放入.NET DLL中?
示例演示了如何将流程入口点放在C#脚本文件C# 如何将Azure函数的入口点放入.NET DLL中?,c#,azure-functions,C#,Azure Functions,示例演示了如何将流程入口点放在C#脚本文件.csx中。但是,如何使用常规的C#library(DLL)实现这种行为呢?我能让Kudu像为Webapp编写库一样先编译库吗?Joannes 这目前不受支持,但您可以使用所述函数发布程序集,只需让函数入口点调用程序集中的相应方法即可: #r "MyAssembly.dll" public static void Run(/*...args...*/) { MyAssembly.MyMethod(/*..args...*/); } 乔安妮 这
.csx
中。但是,如何使用常规的C#library(DLL)实现这种行为呢?我能让Kudu像为Webapp编写库一样先编译库吗?Joannes
这目前不受支持,但您可以使用所述函数发布程序集,只需让函数入口点调用程序集中的相应方法即可:
#r "MyAssembly.dll"
public static void Run(/*...args...*/)
{
MyAssembly.MyMethod(/*..args...*/);
}
乔安妮
这目前不受支持,但您可以使用所述函数发布程序集,只需让函数入口点调用程序集中的相应方法即可:
#r "MyAssembly.dll"
public static void Run(/*...args...*/)
{
MyAssembly.MyMethod(/*..args...*/);
}
在撰写这个问题时,它还没有得到支持,但现在它得到了支持 摘自维基:
{
"scriptFile": "PreCompiledFunctionSample.dll",
"entryPoint": "PreCompiledFunctionSample.MyFunction.Run",
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in"
},
{
"name": "$return",
"type": "http",
"direction": "out"
}
],
"disabled": false
}
在撰写这个问题时,它还没有得到支持,但现在它得到了支持 摘自维基:
{
"scriptFile": "PreCompiledFunctionSample.dll",
"entryPoint": "PreCompiledFunctionSample.MyFunction.Run",
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in"
},
{
"name": "$return",
"type": "http",
"direction": "out"
}
],
"disabled": false
}
您是否将PrecompiledFunctionSample.Dll放在d:/site/wwwroot/MyFunction/bin下?我不能让它工作太多,除非在本地模拟器上。嵌入在Dll中并声明为入口点id的函数未被Kudu根据日志找到,即使它是公共的、静态的,在公共类中。老实说,我自己还没有做过(我一直想做)。我两个都要试试。我还要确保您运行的是最新版本的Azure函数,您使用的版本不会自动升级,您必须自己进行升级(您可以通过Azure门户进行升级)。您是否将PrecompiledFunctionSample.Dll放在d:/site/wwwroot/MyFunction/bin下?我不能让它工作太多,除非在本地模拟器上。嵌入在Dll中并声明为入口点id的函数未被Kudu根据日志找到,即使它是公共的、静态的,在公共类中。老实说,我自己还没有做过(我一直想做)。我两个都要试试。我还要确保您正在运行最新版本的Azure功能,您使用的版本不会自动升级,您必须自己进行升级(您可以通过Azure门户进行升级)。