![](/img/trans.png)
[英]Deploy Web App from Visual Studio Code to Azure App Service
[英]Is it possible for me to deploy an azure web app by zip on Visual studio Team service?
我建立了一個連接到我的工作帳戶的Azure Web應用程序。 現在,我想使用我的個人帳戶將其放入Visual Studio TEAM服務(用於連續開發)。 我知道我需要為此創建一個版本...。但是由於我的個人帳戶未鏈接到該Web應用程序,因此無法使用Azure Web App模板。 在網上搜索后,我找到了一種方法,即通過publish.js。 由於它適用於Azure bot服務,因此我嘗試一下。 但是,在構建完成之后,我注意到該更改未反映在Web應用程序上。...我想知道我是否可以在Visual Studio Team Service中通過zip部署Azure Web應用程序?
這里是示例publish.js代碼:
var zipFolder = require('zip-folder');
var path = require('path');
var fs = require('fs');
var request = require('request');
var rootFolder = path.resolve('.');
var zipPath = path.resolve(rootFolder, './test.zip');
var kuduApi = '';
var userName = '';
var password = '';
function uploadZip(callback) {
fs.createReadStream(zipPath).pipe(request.put(kuduApi, {
auth: {
username: userName,
password: password,
sendImmediately: true
},
headers: {
"Content-Type": "applicaton/zip"
}
}))
.on('response', function(resp){
if (resp.statusCode >= 200 && resp.statusCode < 300) {
fs.unlink(zipPath);
callback(null);
} else if (resp.statusCode >= 400) {
callback(resp);
}
})
.on('error', function(err) {
callback(err)
});
}
function publish(callback) {
zipFolder(rootFolder, zipPath, function(err) {
if (!err) {
uploadZip(callback);
} else {
callback(err);
}
})
}
publish(function(err) {
if (!err) {
console.log('testit-89d8 publish');
} else {
console.error('failed to publish testit-89d8', err);
}
});
我發現了錯誤日志,它太長了,因此這里只是其中的一部分:
無法發布qnalist IncomingMessage {
2018-04-18T19:36:20.1013703Z _readableState:
2018-04-18T19:36:20.1013848Z ReadableState {
2018-04-18T19:36:20.1013952Z objectMode: false,
2018-04-18T19:36:20.1014061Z highWaterMark: 16384,
2018-04-18T19:36:20.1014184Z buffer: BufferList { head: null, tail: null, length: 0 },
2018-04-18T19:36:20.1014367Z length: 0,
2018-04-18T19:36:20.1014485Z pipes: null,
2018-04-18T19:36:20.1014589Z pipesCount: 0,
2018-04-18T19:36:20.1014694Z flowing: null,
2018-04-18T19:36:20.1015019Z ended: false,
2018-04-18T19:36:20.1015112Z endEmitted: false,
2018-04-18T19:36:20.1015203Z reading: false,
2018-04-18T19:36:20.1015292Z sync: true,
2018-04-18T19:36:20.1015427Z needReadable: false,
2018-04-18T19:36:20.1015524Z emittedReadable: false,
2018-04-18T19:36:20.1015681Z readableListening: false,
2018-04-18T19:36:20.1015821Z resumeScheduled: false,
2018-04-18T19:36:20.1015928Z destroyed: false,
2018-04-18T19:36:20.1016022Z defaultEncoding: 'utf8',
2018-04-18T19:36:20.1016113Z awaitDrain: 0,
2018-04-18T19:36:20.1016253Z readingMore: true,
2018-04-18T19:36:20.1016343Z decoder: null,
2018-04-18T19:36:20.1016433Z encoding: null },
2018-04-18T19:36:20.1016522Z readable: true,
2018-04-18T19:36:20.1016653Z domain: null,
2018-04-18T19:36:20.1016739Z _events:
2018-04-18T19:36:20.1016841Z { end: [ [Function: responseOnEnd], [Function], [Object] ],
2018-04-18T19:36:20.1016980Z close: [Function] },
2018-04-18T19:36:20.1017072Z _eventsCount: 2,
2018-04-18T19:36:20.1017164Z _maxListeners: undefined,
2018-04-18T19:36:20.1017252Z socket:
2018-04-18T19:36:20.1017377Z TLSSocket {
2018-04-18T19:36:20.1017467Z _tlsOptions:
2018-04-18T19:36:20.1017557Z { pipe: false,
2018-04-18T19:36:20.1018481Z secureContext: [Object],
2018-04-18T19:36:20.1018628Z isServer: false,
2018-04-18T19:36:20.1019590Z requestCert: true,
2018-04-18T19:36:20.1019690Z rejectUnauthorized: true,
2018-04-18T19:36:20.1019839Z session: undefined,
2018-04-18T19:36:20.1019937Z NPNProtocols: undefined,
2018-04-18T19:36:20.1020036Z ALPNProtocols: undefined,
2018-04-18T19:36:20.1020134Z requestOCSP: undefined },
2018-04-18T19:36:20.1020267Z _secureEstablished: true,
2018-04-18T19:36:20.1020363Z _securePending: false,
2018-04-18T19:36:20.1020459Z _newSessionPending: false,
2018-04-18T19:36:20.1020555Z _controlReleased: true,
2018-04-18T19:36:20.1020690Z _SNICallback: null,
2018-04-18T19:36:20.1020783Z servername: null,
2018-04-18T19:36:20.1020877Z npnProtocol: undefined,
2018-04-18T19:36:20.1021011Z alpnProtocol: false,
2018-04-18T19:36:20.1021224Z authorized: true,
2018-04-18T19:36:20.1021637Z authorizationError: null,
2018-04-18T19:36:20.1021749Z encrypted: true,
2018-04-18T19:36:20.1021910Z _events:
2018-04-18T19:36:20.1022014Z { close: [Array],
2018-04-18T19:36:20.1022119Z end: [Array],
2018-04-18T19:36:20.1022232Z finish: [Function: onSocketFinish],
2018-04-18T19:36:20.1022399Z _socketEnd: [Function: onSocketEnd],
2018-04-18T19:36:20.1022514Z secure: [Function],
2018-04-18T19:36:20.1022626Z free: [Function: onFree],
2018-04-18T19:36:20.1022784Z agentRemove: [Function: onRemove],
2018-04-18T19:36:20.1022901Z drain: [Function: ondrain],
2018-04-18T19:36:20.1023018Z error: [Function: socketErrorListener],
2018-04-18T19:36:20.1023137Z data: [Function: socketOnData] },
2018-04-18T19:36:20.1023285Z _eventsCount: 10,
2018-04-18T19:36:20.1023392Z connecting: false,
2018-04-18T19:36:20.1023497Z _hadError: false,
2018-04-18T19:36:20.1023598Z _handle:
2018-04-18T19:36:20.1023750Z TLSWrap {
2018-04-18T19:36:20.1023856Z _parent: [Object],
2018-04-18T19:36:20.1023965Z _parentWrap: undefined,
2018-04-18T19:36:20.1024126Z _secureContext: [Object],
2018-04-18T19:36:20.1024235Z reading: true,
2018-04-18T19:36:20.1024340Z owner: [Circular],
2018-04-18T19:36:20.1024451Z onread: [Function: onread],
2018-04-18T19:36:20.1024720Z writeQueueSize: 0,
您需要使用zip部署Kudu API(/ api / zipdeploy)。
另一方面,對於Azure Web App部署任務,它使用Azure訂閱終結點進行授權(在Azure App Service Deploy任務的“ Azure訂閱”輸入框中選擇)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.