Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在C#中为Azure应用程序网关创建基于路径的路由规则?_C#_Azure_Azure Application Gateway - Fatal编程技术网

如何在C#中为Azure应用程序网关创建基于路径的路由规则?

如何在C#中为Azure应用程序网关创建基于路径的路由规则?,c#,azure,azure-application-gateway,C#,Azure,Azure Application Gateway,通过Azure Portal,我使用基于路径的路由手动创建了一个应用程序网关。现在,我需要在C#中实现这一点的自动化。我似乎找不到任何方法来创建基于路径的路由规则。我正在使用Microsoft.Azure.Management.Fluent软件包。我错过了什么 如果Fluent API不支持这一点,是否有REST替代方案 例: 我可以在Microsoft.Azure.Management.Fluent包中找到,但找不到配置它的方法。github中也有与此相关的内容 但它肯定可以使用包创建具有基于

通过Azure Portal,我使用基于路径的路由手动创建了一个应用程序网关。现在,我需要在C#中实现这一点的自动化。我似乎找不到任何方法来创建基于路径的路由规则。我正在使用Microsoft.Azure.Management.Fluent软件包。我错过了什么

如果Fluent API不支持这一点,是否有REST替代方案

例:

我可以在Microsoft.Azure.Management.Fluent包中找到,但找不到配置它的方法。github中也有与此相关的内容

但它肯定可以使用包创建具有基于路径的路由设置的
应用程序网关

以下是一个例子:

        ApplicationGateway gateway = new ApplicationGateway();

        //configure thepath-based routing.
        ApplicationGatewayRequestRoutingRule r = new ApplicationGatewayRequestRoutingRule();
        r.RuleType = ApplicationGatewayRequestRoutingRuleType.PathBasedRouting;
        gateway.RequestRoutingRules.Add(r);

        //configure other settings.
        //gateway.Location = "xxx";

        gateway.Validate();

        //create the gateway.
        NetworkManagementClient networkManagementClient = new NetworkManagementClient(your_credential);
        networkManagementClient.ApplicationGateways.CreateOrUpdate("resource group name", "application gateway name", gateway);
参考代码示例:和


有关api,请参阅。在请求主体中,它定义了基于路径的路由设置。在Azure中配置东西的方法有很多。再次感谢。这对我有用。
        ApplicationGateway gateway = new ApplicationGateway();

        //configure thepath-based routing.
        ApplicationGatewayRequestRoutingRule r = new ApplicationGatewayRequestRoutingRule();
        r.RuleType = ApplicationGatewayRequestRoutingRuleType.PathBasedRouting;
        gateway.RequestRoutingRules.Add(r);

        //configure other settings.
        //gateway.Location = "xxx";

        gateway.Validate();

        //create the gateway.
        NetworkManagementClient networkManagementClient = new NetworkManagementClient(your_credential);
        networkManagementClient.ApplicationGateways.CreateOrUpdate("resource group name", "application gateway name", gateway);