标签: azure-functions

导入Azure功能的Python模块

如何导入Python Azure功能的模块?

import requests
Run Code Online (Sandbox Code Playgroud)

导致:

2016-08-16T01:02:02.317 Exception while executing function: Functions.detect_measure. Microsoft.Azure.WebJobs.Script: Traceback (most recent call last):
  File "D:\home\site\wwwroot\detect_measure\run.py", line 1, in <module>
    import requests
ImportError: No module named requests
Run Code Online (Sandbox Code Playgroud)

相关的,可用的模块记录在哪里?

python azure azure-functions

6
推荐指数
2
解决办法
5105
查看次数

Azure从子文件夹中运行github部署

我正在使用Azure功能与GitHub部署.我想将函数放在src/server/functionName/repo中,但只有直接放置函数时,部署才有效functionName/

如何部署放置在子目录中的函数?

文档的状态

您的host.json文件和函数文件夹应该直接位于您部署的根目录.

但"应该"并不意味着"必须",对吗?

我尝试了什么:

  • host.json和function.json的各种位置组合
  • host.json我设置routePrefix但它似乎只影响函数的URL:"http": { "routePrefix": "src/server" },

azure azure-functions

6
推荐指数
1
解决办法
958
查看次数

如何在Azure功能中定义Azure Blob存储触发器的路径

有没有办法在没有定义具体容器的情况下触发Azure功能?

我期待,下面的函数将被触发任何容器中的任何文件.文件和容器的名称应该是变量.

*****function.json:
{
 "bindings": [
   {
    "type": "blobTrigger",
    "name": "myBlob",
    "path": "{container}/{name}",
    "connection": "AzureWebJobsStorage",
    "direction": "in"
   }
],
 "disabled": false
}

*****run.csx:
public static void Run(Stream myBlob, string name, string container, TraceWriter log, out string outputSbMsg)
{
    log.Info("C# Blob trigger function Processed blob");
    log.Info(name);
    log.Info(container);      
}
Run Code Online (Sandbox Code Playgroud)

但是,什么也没有触发.知道什么是错的吗?

azure azure-blob-storage azure-functions

6
推荐指数
1
解决办法
2992
查看次数

Azure函数中的Autofac依赖注入

我试图在Azure功能中使用Autofac IOC实现DI.我需要构建容器,但不确定将代码放在何处构建容器

dependency-injection inversion-of-control azure autofac azure-functions

6
推荐指数
2
解决办法
6812
查看次数

如何在Azure Functions中使用HttpTrigger进行ModelBinding?

我需要创建一个响应HTTP POST的Azure功能,并利用集成的模型绑定.

我该怎么修改呢

    [FunctionName("TokenPolicy")]
    public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "TokenPolicy/{IssuerID}/{SpecificationID}")]HttpRequestMessage req, string IssuerID, string specificationID, TraceWriter log)
    {
        log.Info("C# HTTP trigger function processed a request. TokenPolicy");

        // Fetching the name from the path parameter in the request URL
        return req.CreateResponse(HttpStatusCode.OK, "data " +  specificationID);
    }
Run Code Online (Sandbox Code Playgroud)

以这种方式,我的客户端POST的对象,我有正常的ASP.NET样式模型绑定?

azure model-binding azure-functions

6
推荐指数
2
解决办法
2662
查看次数

是否可以在Azure功能的Hub启动时运行代码?

我希望在Azure Function的集线器启动时运行代码,并确保在该集线器中调用任何Azure功能之前执行该代码.我能这样做吗?

azure azure-functions

6
推荐指数
1
解决办法
1992
查看次数

Azure函数:CosmosDBTrigger在Visual Studio中未触发

TL; DR此示例不适用于VS2017。


我有一个蓝色的宇宙DB,想什么时候添加或更新有火一些逻辑。为此,CosmosDBTrigger应该很棒。

教程演示了如何在Azure Portal中创建触发器,它对我有用。然而,(现在15.5.4,最新的)做在Visual Studio一样的东西不。

我用的是默认的 Azure的功能模板,预定义的宇宙DB触发和近默认代码:

[FunctionName("TestTrigger")]
public static void Run(    
    [CosmosDBTrigger("Database", "Collection", ConnectionStringSetting = "myCosmosDB")]
    IReadOnlyList<Document> input,
    TraceWriter log)
    {
        log.Info("Documents modified " + input.Count);
        log.Info("First document Id " + input[0].Id);
    }
Run Code Online (Sandbox Code Playgroud)

应用程序运行没有错误,但是当我实际在数据库中进行操作时,什么也没有发生。因此,我无法调试事物并实际上实现一些必需的逻辑。

连接字符串在指定 local.settings.json被认为是。如果我故意犯规,则触发运行时错误。

看起来连接字符串似乎连接到错误的数据库。但是,正是一个,copypasted,字符串我在通过Azure的门户网站所做的扳机。

我该怎么办?我还能检查什么?

c# azure visual-studio azure-functions azure-cosmosdb

6
推荐指数
1
解决办法
1197
查看次数

Newtonsoft 11.0.0.0无法加载Azure Function App 2.0

我使用Azure Http Trigger创建了一个开箱即用的Azure功能应用程序.这给了我下面的代码.我所更新的是我正在将HttpRequest主体转换为我的Helper类.

这是代码

public static class TriggerTest
{
    [FunctionName("TriggerTest")]
    public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, TraceWriter log)
    {

        log.Info("C# HTTP trigger function processed a request.");

        string name = req.Query["name"];

        string requestBody = new StreamReader(req.Body).ReadToEnd();

        Helper data = JsonConvert.DeserializeObject<Helper>(requestBody);

        name = name ?? data?.value;

        return name != null
            ? (ActionResult)new OkObjectResult($"Hello, {name}")
            : new BadRequestObjectResult("Please pass a name on the query string or in the request body");
    }
}

public class Helper
{
    public string value …
Run Code Online (Sandbox Code Playgroud)

c# azure json.net nuget azure-functions

6
推荐指数
1
解决办法
778
查看次数

天蓝色功能服务总线输出消息属性

我正在尝试使用服务总线绑定输出为JavaScript Azure Function中的服务总线消息设置元数据。不幸的是,绑定似乎只支持身体。

查看这些文档,我发现您可以通过以下方式在服务总线触发器中访问此信息,context.bindingData但是我没有看到用于服务总线输出的任何相应接口。

有什么方法可以发送完整的代理消息并设置消息属性(ContentType)和消息自定义属性在此处输入图片说明

javascript azure node.js azureservicebus azure-functions

6
推荐指数
1
解决办法
543
查看次数

仅限Https的Angular 7 PWA + Azure Functions网关超时504

因此标题几乎说明了一切!

我有一个编译为PWA的Angular 7应用,我的package.json在下面。我的后端api是用AzureFunctions V2编写的。

"dependencies": {
    "@angular-devkit/core": "^7.0.5",
    "@angular/animations": "^7.0.3",
    "@angular/cdk": "^7.0.3",
    "@angular/common": "^7.0.3",
    "@angular/compiler": "^7.0.3",
    "@angular/core": "^7.0.3",
    "@angular/flex-layout": "^7.0.0-beta.19",
    "@angular/forms": "^7.0.3",
    "@angular/http": "^7.0.3",
    "@angular/material": "^7.0.3",
    "@angular/platform-browser": "^7.0.3",
    "@angular/platform-browser-dynamic": "^7.0.3",
    "@angular/platform-server": "^7.0.3",
    "@angular/pwa": "^0.10.5",
    "@angular/router": "^7.0.3",
    "@angular/service-worker": "^7.0.3", 
    "@types/date-fns": "^2.6.0",
    "angular-calendar": "^0.26.4",
    "chartist": "^0.11.0",
    "core-js": "^2.5.7",
    "rxjs": "^6.3.3",
    "rxjs-compat": "^6.3.3",
    "zone.js": "^0.8.26"
  },
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是,当我将api端点设置为使用https时,出现504网关超时错误。我知道https的配置/功能很好,因为这都是由Azure使用Azure Functions自动配置的。

我所有的API请求也都可以通过https与Postman一起正常工作。

在此处输入图片说明

更新-有点发展,如果我在未启用PWA的情况下在本地运行,则会得到以下不同的ERR_SPDY_PROTOCOL_ERROR

这是Chrome中的调试信息 chrome://net-internals/#events

t=9314 [st= 1]        UPLOAD_DATA_STREAM_READ  [dt=0]
                      --> current_position = 0
t=9314 [st= 1]        HTTP2_STREAM_UPDATE_SEND_WINDOW
                      --> delta = -73
                      --> stream_id = 3 …
Run Code Online (Sandbox Code Playgroud)

azure-functions angular-httpclient angular-pwa angular7

6
推荐指数
1
解决办法
758
查看次数