• <small id='10QfQ'></small><noframes id='10QfQ'>

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

      <tfoot id='10QfQ'></tfoot>
      1. <legend id='10QfQ'><style id='10QfQ'><dir id='10QfQ'><q id='10QfQ'></q></dir></style></legend>
      2. 如何检查 Azure 功能是否在本地环境中运行?`RoleEnvironment` 在 Azure Functions

        How to check Azure function is running on local environment? `RoleEnvironment` is not working in Azure Functions(如何检查 Azure 功能是否在本地环境中运行?`RoleEnvironment` 在 Azure Functions 中不起作用)
          <bdo id='7WWAI'></bdo><ul id='7WWAI'></ul>

          <small id='7WWAI'></small><noframes id='7WWAI'>

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

              <tbody id='7WWAI'></tbody>
              <legend id='7WWAI'><style id='7WWAI'><dir id='7WWAI'><q id='7WWAI'></q></dir></style></legend>
              <tfoot id='7WWAI'></tfoot>

                • 本文介绍了如何检查 Azure 功能是否在本地环境中运行?`RoleEnvironment` 在 Azure Functions 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在代码中有一个条件,我需要检查当前环境是否不是本地环境.我使用了 !RoleEnvironment.IsEmulated,现在这在 Azure 函数中不起作用,但在云服务中起作用.相同的代码也在云服务中共享,因此解决方案应与云服务和天蓝色功能一起使用.

                  I have a condition in code where i need to check if current environment is not local.i have used !RoleEnvironment.IsEmulated, now this is not working in Azure functions but works in Cloud service. Same code is Shared in Cloud service also, so solution should work with cloud service and azure functions.

                  如何检查当前环境是本地未托管/部署的?

                  how can i check current environment is local not hosted/deployed?

                  推荐答案

                  根据 Fabio Cavalcante 的回答,这是一个有效的 Azure 函数,用于检查当前运行环境(本地或托管):

                  Based on answer by Fabio Cavalcante, here is a working Azure function that checks the current running environment (local or hosted):

                  using System.Net;
                  using System.Net.Http;
                  using System.Threading.Tasks;
                  using Microsoft.Azure.WebJobs;
                  using Microsoft.Azure.WebJobs.Extensions.Http;
                  using Microsoft.Azure.WebJobs.Host;
                  using System;
                  
                  namespace AzureFunctionTests
                  {
                      public static class WhereAmIRunning
                      {
                          [FunctionName("whereamirunning")]
                          public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
                          {
                              bool isLocal = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID"));
                  
                              string response = isLocal ? "Function is running on local environment." : "Function is running on Azure.";
                  
                              return req.CreateResponse(HttpStatusCode.OK, response);
                          }
                      }
                  }
                  

                  这篇关于如何检查 Azure 功能是否在本地环境中运行?`RoleEnvironment` 在 Azure Functions 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                  listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                  Cannot remove items from ListBox(无法从列表框中删除项目)
                  Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                  Drag and drop from list to canvas on windows phone with MVVM(使用 MVVM 在 Windows 手机上从列表拖放到画布)
                  Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)
                  <i id='M9bYV'><tr id='M9bYV'><dt id='M9bYV'><q id='M9bYV'><span id='M9bYV'><b id='M9bYV'><form id='M9bYV'><ins id='M9bYV'></ins><ul id='M9bYV'></ul><sub id='M9bYV'></sub></form><legend id='M9bYV'></legend><bdo id='M9bYV'><pre id='M9bYV'><center id='M9bYV'></center></pre></bdo></b><th id='M9bYV'></th></span></q></dt></tr></i><div id='M9bYV'><tfoot id='M9bYV'></tfoot><dl id='M9bYV'><fieldset id='M9bYV'></fieldset></dl></div>

                • <tfoot id='M9bYV'></tfoot>
                    <legend id='M9bYV'><style id='M9bYV'><dir id='M9bYV'><q id='M9bYV'></q></dir></style></legend>

                      <bdo id='M9bYV'></bdo><ul id='M9bYV'></ul>
                        <tbody id='M9bYV'></tbody>

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