Azure Functions .NetCore 3.0 Request.Query引发“找不到入口点”错误

时间:2019-05-21 16:00:08

标签: azure .net-core-3.0

我有一个Azure Functions项目,该项目在本地构建和运行。我的方法之一尝试访问HttpRequest.Query类以获取querystring中的参数,而该参数最近已经开始引发错误,包括System.Private.CorLib:“找不到入口点”或

System.Private.CoreLib: Exception while executing function: Configurations_Get. 
BC.Functions: Method not found: 'Microsoft.Extensions.Primitives.StringValues 
Microsoft.AspNetCore.Http.IQueryCollection.get_Item(System.String)'.

该函数的代码如下:

[FunctionName("Configurations_Get")]
    public static async Task<IActionResult> GetConfigs(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route=ROUTE)]
        HttpRequest req,
        [Table("configurations", Connection = "AzureWebJobsStorage")] CloudTable configTable,
        ILogger log)
    {
        log.LogInformation("Getting configuration");
        string version = "1.0";
        try
        {
            var query = req.Query;
            version = query["version"];
        }
        catch (Exception e)
        {
            version = "1.0";
            Console.WriteLine(e.Message);
        }

       ....
    }

Nuget版本如下

enter image description here 为什么会这样?是版本问题吗?

1 个答案:

答案 0 :(得分:0)

通过删除不需要的对

的引用来解决
<DOCTYPE not_html>