Tag: Azure的function

找不到工作职能。 尝试公开您的工作类和方法

首先,我查看了其他SOpost,并显示相同的错误消息,似乎没有解决我的问题。 我尝试了许多排列和选项。 我的函数构建正常,但不会在CLI中运行,我得到以下神秘错误。 MSFT文档似乎也没有答案。 找不到工作职能。 尝试公开您的工作类和方法。 如果您正在使用绑定扩展(例如ServiceBus,Timers等),请确保您已在启动代码中调用扩展的注册方法(例如config.UseServiceBus(),config.UseTimers()等)。 我正在尝试运行计时器作业,然后将一组消息写入事件中心。 我错过了什么? 我已经打了好几个小时。 function: [FunctionName(“CreateData”)] public static async Task Run([TimerTrigger(“0 */5 * * * *”)]TimerInfo myTimer, [EventHub(“murraytest”, Connection = “evingest”)] IAsyncCollector myeventhub, TraceWriter log) { await myeventhub.AddAsync(“data1”); await myeventhub.AddAsync(“data2”); await myeventhub.AddAsync(“data3″); log.Info($”COMPLETED: {DateTime.Now}”); } local.settings.json: { “IsEncrypted”: false, “Values”: { “AzureWebJobsStorage”: “UseDevelopmentStorage=true”, “Eventhub”: “UseDevelopmentStorage=true”, “AzureWebJobsDashboard”: “”, “evingest”: “Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=LtcqBLT5VWjg0dGMdIvxCcEGs8902010Y6y14iGg=” […]

从Azure函数中的配置文件加载连接字符串

在我的Azure函数中,我正在使用一个库,它通过ConfigurationManager中的ConnectionString建立与SQL服务器的连接,如下所示: var cs = System.Configuration.ConfigurationManager.ConnectionStrings[“DbConString”].ConnectionString; DbConnection connection = new SqlConnection(cs); 现在,当我通过应用程序设置在门户中设置连接字符串DbConString时,一切正常。 但是对于本地开发,我使用azure-functions-cli,不幸的是我不知道应该在哪里放置连接字符串以通过ConfigurationManager正确加载它。 我试图将它放在appsettings.json文件中,但没有成功。 编辑:我的appsettings.json目前看起来像这样: { “IsEncrypted”: false, “Values”: { “AzureWebJobsStorage”: “”, “AzureWebJobsDashboard”: “”, “MyServiceBusReader”: “Endpoint=sb://xxxx=”, “DbConStr1”: “data source=(localdb)\\MSSQLLocalDB;initial catalog=MyDb;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework”, “ConnectionStrings”: { “DbConStr2”: “data source=(localdb)\\MS…” } } } 但是我无法通过ConfigurationManager访问“DbConStr1”。 如此处所述,在“ConnectionStrings”中添加“DbConStr2”会导致编译错误。 也许是因为我没有使用.NET Core? Edit2:我搞砸了“ConnectionStrings”的嵌套。 它必须与“值”处于相同的嵌套级别: { “IsEncrypted”: false, “Values”: { “AzureWebJobsStorage”: “”, “AzureWebJobsDashboard”: “”, “MyServiceBusReader”: “Endpoint=sb://xxxx=” […]

在Azure Function中运行.exe可执行文件

我有可执行文件abcd.exe(它包含/合并了许多.dll)。 是否可以为abcd.exe创建Azurefunction并在Azure云function中运行它? abcd.exe应用程序: System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = “cmd.exe”; **startInfo.Arguments = “/C abcd.exe”;** process.StartInfo = startInfo; process.Start(); abcd.exe应用程序没有UI(GUI),但它是数学和科学应用程序,它依赖于许多.dll合并在abcd.exe中。 谢谢

为Azurefunction生成输出blob的名称

使用Azurefunction的绑定选项,可以根据从触发器派生的参数(例如,触发该function的队列消息)指定要写入的Blob的名称; 文档显示了一个例子。 我的问题是:处理blob名称事先不知道的情况的最佳方法是什么,但实际上是作为函数执行的一部分计算的? 并且相关:如果函数可能会或可能不会产生输出blob(或多个输出blob!),根据其计算结果怎么办? 据我所知,Azure Function的绑定机制在这些情况下没有多大帮助,最简单的方法是引用一个用azure blob编写“经典方式”的程序集。 但是有更惯用的方式吗?

Azurefunction:仅为新事件配置blob触发器

我的azure色储存中有大约800k的斑点。 当我使用blobTrigger创建azure函数时,它开始处理我在存储中的所有blob。 如何将我的function配置为仅针对新的和更新的blob触发?

无法将参数’log’绑定到类型TraceWriter

在执行右键单击项目时获取以下消息 – >调试 – >启动新实例。 [1/7/2018 6:48:54 AM]发生ScriptHost错误[1/7/2018 6:48:54 AM]执行HTTP请求:{[1/7/2018 6:48:54 AM] Microsoft .Azure.WebJobs.Host:错误索引方法’TestFilesIngestJobs.RunScheduleAsync’。 Microsoft.Azure.WebJobs.Host:无法绑定参数’log’以键入TraceWriter。 确保绑定支持参数Type。 如果您正在使用绑定扩展(例如ServiceBus,Timers等),请确保您已在启动代码中调用扩展的注册方法(例如config.UseServiceBus(),config.UseTimers()等)。 [1/7/2018 6:48:54 AM]“requestId”:“dbb282d7-44e2-44b4-907e-877beac9da2d”,[1/7/2018 6:48:54 AM]错误索引方法’MasterDataFilesIngestJobs.RunScheduleAsync’ [1/7/2018 6:48:54 AM]“方法”:“GET”,

从Azure函数中的local.settings.json中读取自定义设置

我试图从local.settings.json文件中检索自定义设置。 示例我正在尝试读取以下local.settings.json文件中的表列表 { “IsEncrypted”: false, “Values”: { “AzureWebJobsStorage”: “UseDevelopmentStorage=true”, “AzureWebJobsDashboard”: “UseDevelopmentStorage=true”, “TableList”: “TestTableName1,TestTableName2” } } 使用以下代码阅读它 string tableslist = ConfigurationManager.AppSettings[“TableList”]; 并且它有效,但我在一些地方读过,这只适用于本地调试,在生产环境中部署之后可能无效。 有人能指出我如何以正确的方式做到这一点? 或者问题仅适用于连接字符串相关的设置?

预编译的Azurefunction和CloudTable绑定输出不起作用

我正在使用预编译的Azure函数,它看起来像: public static async Task Run(Stream inputBlob, Stream outputJson, Stream outputXml, CloudTable schedulerTable) 输出绑定看起来: { “name”: “schedulerTable”, “type”: “table”, “direction”: “out”, “tableName”: “SchedulerTable”, “connection”: “SchedulerTable” } 当我从我的函数中删除参数schedulerTable时,它是有效的。 “主持人扔在我脸上的信息是: Microsoft.Azure.WebJobs.Host: Error indexing method ‘Functions.InputFileAdaptorAF’. Microsoft.Azure.WebJobs.Host: Can’t bind Table to type ‘Microsoft.WindowsAzure.Storage.Table.CloudTable’. 真的,当我添加一个表输出绑定尝试使用不同的替代品时,没有任何作用。 不起作用的替代方案是: 参数schedulerTable,类型为SchedulerRegister。 SchedulerRegister类inheritance自TableEntity。 带有ICollector类型的参数schedulerTable。 参数schedulerTable,类型为CloudTable。 (上述情况)。 拜托,我怎么能解决它? (使用输出绑定到azure表)

Azure函数使用TraceWriter在外部库中进行日志记录

如何重用azure函数中可用的TraceWriter对象来记录外部引用的库中的信息? 我尝试使用构造函数传入对象并引用TraceWriter类(web.http.tracing)。 我没有运气,因为课程看起来不同。

如何将输出值绑定到异步Azurefunction?

如何将输出绑定到异步函数? 将参数设置为out的常用方法不适用于异步函数。 例 using System; public static async void Run(string input, TraceWriter log, out string blobOutput) { log.Info($”C# manually triggered function called with input: {input}”); await Task.Delay(1); blobOutput = input; } 这导致编译错误: [timestamp] (3,72): error CS1988: Async methods cannot have ref or out parameters 使用绑定(fyi) { “bindings”: [ { “type”: “blob”, “name”: “blobOutput”, “path”: “testoutput/{rand-guid}.txt”, […]