配置环境变量 - 将ASP.NET CORE APP部署到Azure时。 [英] Configure an environment variable - When Deploying ASP.NET CORE APP to Azure.

查看:90
本文介绍了配置环境变量 - 将ASP.NET CORE APP部署到Azure时。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行Azure教程(将ASP.NET核心应用程序部署到Azure)时获取错误



并运行以下命令来配置部署的连接应用程序到Azure。
$


以下是我运行的命令。到 
配置环境变量




zahid @ Azure:〜$ az webapp config连接-string设置--resource基myResourceGroup --name TodoListApp --settings MyDbConnection ='服务器= TCP:zahidserver.database.windows.net,1433;数据库= coreDB;用户ID = XXXX;密码= XXXXX;加密= TRUE;连接Timeout = 30;' - connection-string-type
SQLServer


az webapp config connection-string set:error:需要以下参数: - connect-string- type / -t

用法:az webapp config连接字符串设置[-h] [--verbose] [--debug]

     ;                        &NBSP ;                
[ - 输出{json,jsonc,table,tsv,yaml,none}]

                                               
[--query JMESPATH]

                                               
[--resource-group RESOURCE_GROUP_NAME]

                                               
[--name NAME]

                                               
--connection串型

               &NBSP ;                        &NBSP ;    
{的MySQL,SQLServer的,SQLAzure,自定义,NotificationHub,ServiceBus,EventHub,ApiHub,DocDb,RedisCache时,PostgreSQL}

       &NBSP ;                        &NBSP ;            
[-settings SETTINGS [SETTINGS ...]]
$
                                               
[--slot SLOT]

                                               
[--slot-settings SLOT_SETTINGS [SLOT_SETTINGS ...]]

                                               
[--subscription _SUBSCRIPTION]

                                               
[ - ID ID [ID ...]]

zahid @ Azure:〜$
$




谢谢你

解决方案

请尝试使用以下cmdlet,让我们了解错误的详细信息,以获得进一步的帮助。


az webapp config connection-string set -g MyResourceGroup -n MyUniqueApp -t

SQLServer的   \ --settings了SQLServer1 = '服务器= myServer上;数据库= MYDB; UID = MYUSER; PWD = MYPWD;'


<跨度style ="font-size:10.0pt; font-family:'Verdana',sans-serif">另外,看一下参考

document
语法,必需和可选参数。 AZ web应用配置连接字符串设置--connection串型{ApiHub,自定义,DocDb,EventHub,MySQL和NotificationHub和PostgreSQL,RedisCache,SQLAzure,SQLServer的,ServiceBus}


< p类= "背景:白色"> <跨度风格= "字体大小:10.0pt;字体家庭: '宋体',无衬线"> <跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
[ - ids]


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
[ - name]


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
[ - resource-group]


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
[ - 设置]


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;  
[ - slot]


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
[ - slot-settings]


<跨度>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
[ - 订阅]




Getting the error while going through Azure Tutorial (Deploying ASP.NET Core App to Azure)

and running following command to configure connections for deployment of app to Azure.

following is the command I ran. to  Configure an environment variable

zahid@Azure:~$ az webapp config connection-string set --resource-group myResourceGroup --name TodoListApp --settings MyDbConnection='Server=tcp: zahidserver.database.windows.net,1433;Database=coreDB;UserID=xxxx;Password=xxxxx;Encrypt=true;Connection Timeout=30;'--connection-string-type SQLServer

az webapp config connection-string set: error: the following arguments are required: --connection-string-type/-t
usage: az webapp config connection-string set [-h] [--verbose] [--debug]
                                              [--output {json,jsonc,table,tsv,yaml,none}]
                                              [--query JMESPATH]
                                              [--resource-group RESOURCE_GROUP_NAME]
                                              [--name NAME]
                                              --connection-string-type
                                              {MySql,SQLServer,SQLAzure,Custom,NotificationHub,ServiceBus,EventHub,ApiHub,DocDb,RedisCache,PostgreSQL}
                                              [--settings SETTINGS [SETTINGS ...]]
                                              [--slot SLOT]
                                              [--slot-settings SLOT_SETTINGS [SLOT_SETTINGS ...]]
                                              [--subscription _SUBSCRIPTION]
                                              [--ids ID [ID ...]]
zahid@Azure:~$


Thanks

解决方案

Kindly try the following cmdlets and let us know how it goes with more details on the error for further assistance.
az webapp config connection-string set -g MyResourceGroup -n MyUniqueApp -t
SQLServer  \ --settings SQLServer1='Server=myServer;Database=myDB;Uid=myUser;Pwd=myPwd;'

Also, take a look at the reference document for the complete cmdlet syntax, required and optional parameters. az webapp config connection-string set --connection-string-type {ApiHub, Custom, DocDb, EventHub, MySql, NotificationHub, PostgreSQL, RedisCache, SQLAzure, SQLServer, ServiceBus}

                                       [--ids]

                                       [--name]

                                       [--resource-group]

                                       [--settings]

                                       [--slot]

                                       [--slot-settings]

                                       [--subscription]



这篇关于配置环境变量 - 将ASP.NET CORE APP部署到Azure时。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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