微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用应用服务在 azure 上部署 express-gateway

如何解决如何使用应用服务在 azure 上部署 express-gateway

创建了 express-gateway 应用程序,现在我正在尝试在 azure 上进行部署,并为此创建了 Azure 应用服务,一旦创建了应用服务而不是使用 Github 部署过程,在应用服务上部署了代码,现在当我尝试在浏览器上访问应用服务时,我收到 500.1001 错误 并且日志消息就像 iisnode 无法建立到节点的命名管道连接.exe 进程

Web.config

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.ss.usermodel.*;

import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

class ExcelFromOPC {

  public static void main(String[] args) throws Exception {
    File file = new File("./inspection.xlsx");

    //OPCPackage pkg = OPCPackage.open(file);
    OPCPackage pkg = OPCPackage.open(new FileInputStream(file));
    XSSFWorkbook wb = new XSSFWorkbook(pkg);
    
    //XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(file));
    //Workbook wb = WorkbookFactory.create(new FileInputStream(file));

    //wb -> sheets -> rows -> cols
    int finding = 445;

    DataFormatter formatter = new DataFormatter();
    boolean write = false;
    for(Sheet sheet : wb) {
      for(Row row : sheet) {
        if(row.getCell(0)!=null && !formatter.formatCellValue(row.getCell(0)).equals("")) {
          Cell cell = row.getCell(0);
          String text = formatter.formatCellValue(cell);
          if('0'<=text.charat(0) && text.charat(0)<='9') {
            int id = Integer.parseInt(text);
            if (id == finding) {
              System.out.println(sheet.getSheetName());
              System.out.println(sheet.getRow(row.getRowNum()).getCell(1));
              Cell cellCurrent = row.getCell(2);
              if (cellCurrent == null) {
                cellCurrent = row.createCell(2);
              }
              cellCurrent.setCellValue("X");
              write = true;
            }
          }
        }
      }
    }

    if (write) {
        System.out.println("writing");
        FileOutputStream outputStream = new FileOutputStream(file);
        wb.write(outputStream);
        outputStream.close();
        wb.close();
    }
  }

}

Server.js

<?xml version="1.0" encoding="utf-8"?>
  <!--
For more information on how to configure your Node.js application,please visit
http://go.microsoft.com/fwlink/?LinkId=290972
-->
  <configuration>
  <appSettings>
  <!--
  <add key="StorageAccountName" value="" />
  <add key="StorageAccountKey" value="" />
  <add key="ServiceBusNamespace" value="" />
  <add key="ServiceBusIssuerName" value="" />
  <add key="ServiceBusIssuerSecretKey" value="" />
  -->
  </appSettings>
  <system.webServer>
  <!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
  <staticContent>
  <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
  </staticContent>

  <modules runAllManagedModulesForAllRequests="false" />

  <!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. -->
  <iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"/>

  <!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above,and uncomment iisnode below. -->
  <!--<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"
loggingEnabled="true"
devErrorsEnabled="true"
nodeProcessCommandLine="node.exe &#45;&#45;debug"/>-->

  <!-- indicates that the server.js file is a Node.js application
to be handled by the iisnode module -->
  <handlers>
  <add name="iisnode" path="server.js" verb="*" modules="iisnode" />

  <!-- Remote debugging (Azure Website with git deploy): Uncomment NtvsDebugProxy handler below.
Additionally copy Microsoft.NodejsTools.Webrole to 'bin' from the Remote Debug Proxy folder.-->
  <!--<add name="NtvsDebugProxy" path="ntvs-debug-proxy/f45f6d32-816b-47f0-8bfa-47f7930108a4" verb="*" resourceType="Unspecified"
type="Microsoft.NodejsTools.Debugger.WebSocketProxy,Microsoft.NodejsTools.Webrole"/>-->
  </handlers>

  <security>
  <requestfiltering>
  <hiddenSegments>
  <remove segment="bin" />
  </hiddenSegments>
  </requestfiltering>
  </security>

  <rewrite>
  <rules>
  <clear />
  <!-- Remote debugging (Azure Website with git deploy): Uncomment the NtvsDebugProxy rule below. -->
  <!--<rule name="NtvsDebugProxy" enabled="true" stopProcessing="true">
  <match url="^ntvs-debug-proxy/.*"/>
  </rule>-->

  <!-- Don't interfere with requests for node-inspector debugging -->
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^server.js\/debug[\/]?" />
        </rule>

        <rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="iisnode.+" negate="true" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
          <action type="Rewrite" url="server.js" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

  <!-- Remote debugging (Azure Website with git deploy): uncomment system.web below -->
  <!--<system.web>
    <httpRuntime targetFramework="4.5"/>
    <customErrors mode="Off"/>
  </system.web>-->
  </configuration>

gateway.config.yml

require('dotenv').config();
var request = require('request');

const path = require('path');
const gateway = require('express-gateway');

gateway()
  .load(path.join(__dirname,'config'))
  .run();

enter image description here

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