我构建了一个链接到我的工作帐户的azure web应用程序。现在我想使用我的个人帐户将它放在Visual Studio TEAM服务上(用于连续开发)。我知道我需要为它创建一个版本....但由于我的个人帐户没有链接到网络应用程序,我无法使用天蓝色的网络应用程序模板。在线搜索之后,我找到了一种方法,这是通过publish.js。因为它适用于azure bot服务,所以我只是试一试。但是,在构建完成后,我注意到更改没有反映在Web应用程序上....我想我是否可以在Visual Studio Team服务上通过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,
答案 0 :(得分:0)
您需要使用zip部署Kudu API(/ api / zipdeploy)。
另一方面,对于Azure Web App部署任务,它使用Azure订阅端点进行授权(在Azure App Service Deploy任务的Azure订阅输入框中选择)。