Я разрабатываю http-триггер, используя функции Azure 2.x и ядро dotnet, после последнего обновления до VS 2017 15.8.2 Я получаю следующую ошибку при локальном запуске функции
1/9/2018 13:30:50] Stopping Host
[1/9/2018 13:31:06] Reading host configuration file 'C:\Users\MattDouhan\source\repos\NWMposTransInput\NWMposTransInput\bin\Debug\netstandard2.0\host.json'
[1/9/2018 13:31:06] Host configuration file read:
[1/9/2018 13:31:06] {}
[1/9/2018 13:31:06] Starting Host (HostId=desktop7cks1do-260439321, InstanceId=5fd41a43-b3ca-47e4-adf6-320d40fa9613, Version=2.0.11960.0, ProcessId=13156, AppDomainId=1, Debug=False, ConsecutiveErrors=5, StartupCount=6, FunctionsExtensionVersion=)
[1/9/2018 13:31:07] A ScriptHost error has occurred
[1/9/2018 13:31:07] System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.Hosting.IWebJobsStartup' from assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
[1/9/2018 13:31:07] Stopping Host
Я использую инструменты Function Core 2.0.1-Beta.35 и среду исполнения 2.0.11960.0
Функция выглядит следующим образом
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
using Microsoft.Extensions.Logging;
using System;
namespace NWMposTransInput
{
public static class Function1
{
[FunctionName("Function1")]
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]
HttpRequest req, ILogger log,
[CosmosDB(
databaseName: "xxxx",
collectionName: "yyyy",
ConnectionStringSetting = "CosmosDbConnection")]out dynamic document,
ILogger log2)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = new StreamReader(req.Body).ReadToEnd();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
document = new { SSourceSystem = "jongelSystem",
id = Guid.NewGuid(),
SSourceSystemVersion = "1.1",
STransactionId = "12345"};
log.LogInformation($"C# Queue trigger function inserted one row");
log.LogInformation($"Description={req.Body}");
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 NWCloudOrder
{
public string Id { get; set; }
public string SSourceSystem { get; set; }
public string SSourceSystemVersion { get; set; }
public string STransactionId { get; set; }
}
}
--- РЕДАКТИРОВАТЬ ---
Убедившись, что я использую правильное время выполнения, теперь выдается следующая ошибка
[2/9/2018 05:44:15] A ScriptHost error has occurred
[2/9/2018 05:44:15] System.Private.CoreLib: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[2/9/2018 05:44:15] Stopping Host
У меня установлен 2.2.0-preview1-35029