如何将 Cordova 平台\浏览器\www 内容部署到 Azure 应用服务?

如何解决如何将 Cordova 平台\浏览器\www 内容部署到 Azure 应用服务?

我在 Cordova 中创建了一个应用程序,我只想在浏览器而不是 Android 或 iOS 中运行它。通过在我的 VS Code 编辑器中运行命令“cordova s​​erve”,我的应用程序在本地机器上完美运行。我正在尝试通过以下步骤在 Azure 上发布它:

  1. 使用以下配置创建了一个 Azure 应用程序:

    enter image description here

  2. 将所有文件和文件夹从platforms/browser/www拖放到Kudu

    enter image description here

  3. 浏览时出现以下错误:

    enter image description here

我的 initController.js

var initControllerDependencies = [];
var device = Framework7.prototype.device;
var deviceOS = device.os;
var nativeDep = 'js/util/mockNative';

// check device and plug appropriate native js
if (deviceOS) {
   if (deviceOS.indexOf('ios') !== -1 || deviceOS.indexOf('android') !== -1) {
      nativeDep = 'js/util/nativeFacade';
   }
}
initControllerDependencies.push(nativeDep);
initControllerDependencies.push("js/util/restUrl");
initControllerDependencies.push("ev");
initControllerDependencies.push("js/util/util");
initControllerDependencies.push("js/util/labelManager");
initControllerDependencies.push("hbs!js/init/header-info");
initControllerDependencies.push("hbs!js/init/user-items");


/**
 * This controller is called only once on init.
 */
define(initControllerDependencies,function(Native,RestClient,ev,Util,LabelManager,pageHeaderTemplate,userItems) {
   
    

    /**
     * Runs on the start of the application. 1. Get Language 2. Get labels
     */
    function init() {
        f7.showPreloader();
        //getLanguage();
        Native.getDeviceLocale();       
    }

    // Holds all the elements that needs to be binded while rendering the view
    var bindings = [ {
        element : '#logOut',event : 'click.ev',handler : logOut          
      },{
        element : '#ev-lnkEditProfile',handler : function(){
            f7.closeModal('.popover-links');
        }         
      }
    ];

      function logOut() {
        f7.closeModal('.popover-links');
        $("#pageHeader").css("display","none");     
        f7.showPreloader(LabelManager.getApplicationData("lbl_Logout"));
  
        var getLogOutXhr = RestClient.makeLogOutXhr();
        getLogOutXhr.done(function() {
       Util.clearStoredUserCredentials();
       f7.mainView.router.loadPage(userLoginPageUrl);
       f7.hidePreloader();
        }).fail(function() {
       f7.hidePreloader();
        });
  
     }

      function bindEvents(bindings) {
        for ( var i in bindings) {
       $(bindings[i].element).on(bindings[i].event,bindings[i].handler);
        }
     };
    
    function setAppInitData(){
        f7.params.modalTitle = LabelManager.getPageTitleByModuleName("lbl_app_title");
        f7.params.modalButtonOk =  LabelManager.getApplicationData('lbl_app_ok');
        f7.params.modalButtonCancel =  everestCache['commonHtml']['lbl_cancel'];
        f7.params.modalPreloaderTitle = LabelManager.getApplicationData('lbl_loading');
        f7.params.smartSelectPopupCloseText =  LabelManager.getApplicationData('lbl_close');
        f7.params.notificationTitle = LabelManager.getApplicationData('lbl_validation_msg');        
    }

    /*
     * Gets the list of supported languages and maps it based on the device language.
     * Defaults to English,language Id 1
     */
    function getLanguage(phoneLocale) {
        var langXhr = RestClient.makeLanguagesRsXhr();
        langXhr.done(function(data) {
            // default locale as of device
            var deviceLanguage = 'en';

            // get device locale            
            var fetchedDeviceLocale = phoneLocale;

            // fetchedDeviceLocale en-IN
            if (fetchedDeviceLocale) {
                deviceLanguage = fetchedDeviceLocale.substring(0,2);
            }

            // to find if available in the list of available languages
            $.each(data,function(index,language) {
                var langDesc = language['languageValue']; // eg:en

                if (langDesc === deviceLanguage) {
                    // load into app scope for usage across
                    appScopeData['displayLangId'] = language['languageId'];
                    appScopeData['localeForMapLoad'] = langDesc;
                }
            });
        });

        langXhr.always(function() {
            // defaults
            if (!appScopeData['displayLangId']) {
                appScopeData['displayLangId'] = 1;
            }
            if (!appScopeData['localeForMapLoad']) {
                appScopeData['localeForMapLoad'] = 'en';
            }

            // call next operation. To fetch Header and Framework 7 defaults            
            getStaticLabels();  
            initializeHeader();     
        });
    }
        
    function afterPhoneLocaleFetched(phoneLocale){     
       getLanguage(phoneLocale);       
    }

    /*
     * Fetch Labels for page Title.
     */ 
    function getStaticLabels() {
        var commonHtmlXhr = RestClient.makeLabelsRsXhr('commonHtml');
        var pageTitleXhr = RestClient.makeLabelsRsXhr('pageTitle');
        var commonXhr = RestClient.makeLabelsRsXhr('common');

        commonHtmlXhr.done(function(data) {
            everestCache['commonHtml'] = data;
            $('.logo-message-inset').html(data['lbl_Filtration']);
            $('#footer_setup_mon .tabbar-label').html(data['lnk_monitorFooter']);
            $('#footer_tips .tabbar-label').html(data['footer_tips']);
            $('#footer_sites .tabbar-label').html(data['footer_sites']);
            $('#footer_user_profile .tabbar-label').html(data['footer_profile']);
            toolBarBinding();
        });

        pageTitleXhr.done(function(data) {
            everestCache['pageTitle'] = data;
        });

        commonXhr.done(function(data) {
            everestCache['common'] = data;
        });

        var initPromise = [ commonHtmlXhr,pageTitleXhr,commonXhr ];

        $.when(commonHtmlXhr,commonXhr).done(function(data) {
            setAppInitData();           
            if (localStorage['isUserAuthenticated'] === 'true') {               
                var checkForStoresXhr = RestClient.makeStoreCheckXhr();

                checkForStoresXhr.done(function(data) {
                    if (checkForStoresXhr.status !== 204) {
                        loggedInUser['hasStore'] = false;

                        if (!loggedInUser['address']) {
                            var getUserAddressXhr = RestClient.makeGetAddressXhr();

                            getUserAddressXhr.done(function(data) {                             
                                loggedInUser['address'] = data["userAddressAstext"];
                                ev.router.loadModule(selectMonitorTypePage);
                            }).fail(function() {
                               Util.authorisedXhrFailed(getUserAddressXhr);
                            });
                        } else {
                            ev.router.loadModule(selectMonitorTypePage);
                        }
                        f7.hidePreloader(); 
                    } else {
                        loggedInUser['hasStore'] = true;
                        loggedInUser['mapViewInitStores'] = data;   
                        $("#pageHeader").css("display","block");                                            
                        ev.router.loadModule(mapViewPageUrl);
                    }
                    
                        
                    
                }).fail(function() {                   
                    /*f7.hidePreloader();                   
                    if (checkForStoresXhr.status === 403 || checkForStoresXhr.status === 401){
                        Util.loadLoginPage(ev);
                    }else{  //TODO load error page
                        Util.loadLoginPage(ev);
                        //f7.alert(LabelManager.getApplicationData('lbl_FailedMessage'));
                    }
                    */
                    Util.clearStoredUserCredentials();
                    Util.loadLoginPage(ev);
                
                });
            } else {                
                ev.router.loadModule(userLoginPageUrl);
            }

            
        }).fail(function(jqXHR) {
            $.each(initPromise,xhr) {
                if (xhr != jqXHR) {
                    xhr.abort();
                }
            });         
        var isErrorPageLoaded = mainView.router.loadPage({
                url : errorPageUrl
                //animatePages : false
            });
        
        if(isErrorPageLoaded === false){
           var reloadErrorPageTimeout;         
           if(reloadErrorPageTimeout){
              clearTimeout(reloadErrorPageTimeout);
           }
           reloadErrorPageTimeout = setTimeout(function(){
              f7.mainView.router.loadPage({
                url : errorPageUrl
              });
           },1000)
           
        }
        });
    }
    //Initialize Header
    var initializeHeader = function initializeHeader() {
        var commonXhr = RestClient.makeLabelsRsXhr('common');
        commonXhr.done(function(data) {
            everestCache['common'] = data;
            everestCache['common']['lbl_Filtration'] = everestCache['commonHtml']['lbl_Filtration'];
            everestCache['common']['lnk_homeHeader'] = everestCache['commonHtml']['lnk_homeHeader'];
            everestCache['common']['lnk_contact'] = everestCache['commonHtml']['lnk_contact'];
            everestCache['common']['lnk_editProfile'] = everestCache['commonHtml']['lnk_editProfile'];
            everestCache['common']['lnk_logout'] = everestCache['commonHtml']['lnk_logout'];
            $("#pageHeader").prepend(pageHeaderTemplate(everestCache['common']));           
            if ($('#userActions').length <= 0) {
                $(userItems(everestCache['common'])).insertAfter(".views");
                 }
            bindEvents(bindings);
            $("#pageHeader").css("display","none");
        });
        
    }

    // Done to initialize toolbar actions
    function toolBarBinding() {
        $('.evToolBar .tab-link').on('click.ev',function() {
            var loadPageUrl = $(this).attr('href');
            ev.router.loadModule(loadPageUrl);
            return false;
        })
    }

    return {
        'init' : init,'initializeHeader' : initializeHeader,"afterPhoneLocaleFetched" : afterPhoneLocaleFetched
    };
});

谁能帮我找出为什么会发生此错误,即使文件位于确切位置。

解决方法

您的 azure webapp 在 windows 平台上。表示你的程序部署在iis中,所以需要web.config文件来定义启动命令或默认文件。

在iis上部署任何语言程序都需要web.config、php、python、nodejs等,这些都是需要的。只需要静态资源的html文件。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-