键入控制台核心 azure 应用程序,并授予最终用户对该应用程序的访问权限 [英] Type into console core azure app and give access to that app to end users

查看:24
本文介绍了键入控制台核心 azure 应用程序,并授予最终用户对该应用程序的访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将控制台网络核心应用程序部署到 azure.我如何向已发布的控制台应用程序写入内容,因为我的控制台应用程序从用户那里获取一些值并打印出来,我找不到此已部署应用程序的链接,然后如何向最终用户授予对该控制台应用程序的访问权限?

I deployed my console net core app to azure. How can i write something to my published console app bcause my console app takes some values from user and prints out, i cannot find link to this deployed application and then how to give access to end user to that console app?

推荐答案

根据我的理解,您发布了一个 .net 核心控制台应用程序作为 Azure Webjobs,并且您正在寻找一个 webhook 以便您可以让您的用户访问此控制台应用程序.您还需要知道如何通过 webhook 将参数传递给它.

Per my understanding, you published a .net core console app as Azure Webjobs, and you are looking for a webhook so that you can let your users access this console app. You also need to know how to pass params to it via webhook.

我为你做了一个简单的 .net core 控制台演示:

I did a simple .net core console demo for you:

using System;

namespace coreconsoleparam
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.WriteLine("agrs received :");
                foreach (string arg in args) {
                    Console.WriteLine(arg+ " ");
                }
            }
            else {
                Console.WriteLine("received no args");
            }
        }
    }
}

并且我已将我的 Web 应用程序发布到 Azure Webjobs.你可以在这里找到它的网络钩子:

And I have published to Azure Webjobs of my web app. You can find its webhook here :

您可以通过 POST 方法使用用户名和密码通过 Http Basic Auth 调用您的控制台应用程序,如下所示:

You can call your console app by POST method with username and password by Http Basic Auth, just as below :

如您所见,在此请求 URL 中,有一个名为 arguments 的参数,您可以使用它来将参数传递给您的控制台应用程序.

As you can see, in this request URL, there is a param named arguments, you can use it to pass params to your console app.

如果您成功调用您的应用,您将收到202 Accepted"响应.

You will get a "202 Accepted" response if you called your app successfully.

最后,让我们检查一下它的日志:

Finally, let's check its log :

如您所见,该应用程序已成功执行并已收到所有参数.

As you can see, the app has been executed successfully and all params has been received .

希望有帮助.

这篇关于键入控制台核心 azure 应用程序,并授予最终用户对该应用程序的访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆