<small id='ARgS6'></small><noframes id='ARgS6'>

        <bdo id='ARgS6'></bdo><ul id='ARgS6'></ul>
    1. <legend id='ARgS6'><style id='ARgS6'><dir id='ARgS6'><q id='ARgS6'></q></dir></style></legend>
        <tfoot id='ARgS6'></tfoot>

        <i id='ARgS6'><tr id='ARgS6'><dt id='ARgS6'><q id='ARgS6'><span id='ARgS6'><b id='ARgS6'><form id='ARgS6'><ins id='ARgS6'></ins><ul id='ARgS6'></ul><sub id='ARgS6'></sub></form><legend id='ARgS6'></legend><bdo id='ARgS6'><pre id='ARgS6'><center id='ARgS6'></center></pre></bdo></b><th id='ARgS6'></th></span></q></dt></tr></i><div id='ARgS6'><tfoot id='ARgS6'></tfoot><dl id='ARgS6'><fieldset id='ARgS6'></fieldset></dl></div>
      1. ConfigurationBuilder 在天蓝色功能中不起作用

        时间:2023-10-25
            <tbody id='gx85V'></tbody>

            <small id='gx85V'></small><noframes id='gx85V'>

            1. <i id='gx85V'><tr id='gx85V'><dt id='gx85V'><q id='gx85V'><span id='gx85V'><b id='gx85V'><form id='gx85V'><ins id='gx85V'></ins><ul id='gx85V'></ul><sub id='gx85V'></sub></form><legend id='gx85V'></legend><bdo id='gx85V'><pre id='gx85V'><center id='gx85V'></center></pre></bdo></b><th id='gx85V'></th></span></q></dt></tr></i><div id='gx85V'><tfoot id='gx85V'></tfoot><dl id='gx85V'><fieldset id='gx85V'></fieldset></dl></div>
              <tfoot id='gx85V'></tfoot>
                <bdo id='gx85V'></bdo><ul id='gx85V'></ul>
              • <legend id='gx85V'><style id='gx85V'><dir id='gx85V'><q id='gx85V'></q></dir></style></legend>
                  本文介绍了ConfigurationBuilder 在天蓝色功能中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 VS2017 中使用 azure functions 模板项目并选择版本 2 (beta).我将它原封不动地发布并且它有效.

                  I'm using azure functions template project in VS2017 and choosing version 2 (beta). I published it unchanged and it worked.

                  我添加了 nuget 包 Microsoft.Extensions.Configuration 并编写了一条语句来初始化 ConfigurationBuilder

                  I added nuget package Microsoft.Extensions.Configuration and wrote a single statement to initialize an instance of ConfigurationBuilder

                  public static class Function1
                  {
                      [FunctionName("Function1")]
                      public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequest req, TraceWriter log)
                      {
                          var cb = new ConfigurationBuilder();// <<<<< added line
                          log.Info("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;
                  
                          return name != null
                              ? (ActionResult)new OkObjectResult($"Hello, {name}")
                              : new BadRequestObjectResult("Please pass a name on the query string or in the request body");
                      }
                  }
                  

                  使用此代码,函数崩溃并出现 500 - 内部服务器错误,我找不到任何原因.

                  With this code the function crashes with 500 - internal server error and I cannot find any reason.

                  我错过了什么吗?如何访问 Azure Functions (v2.0) 中的配置信息

                  Am I missing something? How do I access configuration information in Azure functions (v2.0)

                  在计算模拟器中执行抛出System.Private.CoreLib:执行函数时出现异常:Function1.Aweton.Labs.AzureFunc1:无法加载文件或程序集Microsoft.Extensions.Configuration,Version=2.1.0.0,Culture=neutral,PublicKeyToken=adb9793829ddae60".该系统找不到指定的文件.System.Private.CoreLib:无法加载指定的文件.

                  Executing in Compute emulator throws System.Private.CoreLib: Exception while executing function: Function1. Aweton.Labs.AzureFunc1: Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. System.Private.CoreLib: Could not load the specified file.

                  推荐答案

                  我也遇到了同样的问题.您需要安装以下 nuget 包才能使它们优雅地工作您需要先安装 Microsoft.Extensions.Configuration 才能初始化

                  I was having the same issue. You need following nuget packages to be installed for these to work elegantly You need to install Microsoft.Extensions.Configuration for this to init at first place

                  另外

                  • SetBasePath() 要求:
                    • Microsoft.Extensions.Configuration.Abstractions
                    • Microsoft.Extensions.Configuration.FileExtensions
                    • Microsoft.Extensions.Configuration.Json
                    • Extensions.Configuration.EnvironmentVariables
                    • 可能还有 Microsoft.Extensions.Configuration.UserSecrets

                    请参阅下面的更多信息https://www.koskila.net/如何访问-azure-function-apps-settings-from-c/

                    这篇关于ConfigurationBuilder 在天蓝色功能中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 HTTPS 上的 Visual Studio 中本地运行 Azure Function? 下一篇:在 b2c 中的用户注册上触发 azure 函数

                  相关文章

                  <legend id='T23MU'><style id='T23MU'><dir id='T23MU'><q id='T23MU'></q></dir></style></legend>

                    <small id='T23MU'></small><noframes id='T23MU'>

                  1. <tfoot id='T23MU'></tfoot>
                    • <bdo id='T23MU'></bdo><ul id='T23MU'></ul>

                      <i id='T23MU'><tr id='T23MU'><dt id='T23MU'><q id='T23MU'><span id='T23MU'><b id='T23MU'><form id='T23MU'><ins id='T23MU'></ins><ul id='T23MU'></ul><sub id='T23MU'></sub></form><legend id='T23MU'></legend><bdo id='T23MU'><pre id='T23MU'><center id='T23MU'></center></pre></bdo></b><th id='T23MU'></th></span></q></dt></tr></i><div id='T23MU'><tfoot id='T23MU'></tfoot><dl id='T23MU'><fieldset id='T23MU'></fieldset></dl></div>