2017-10-31 1 views
2

My Ionic2 Node.js 앱이 로컬로 실행되며 GitBash를 사용하여 azure에 성공적으로 푸시했습니다.Azure Ionic App 디렉토리 또는 페이지를 볼 수있는 권한이 없습니다.

때 화면이 표시되어 검색 : ". 당신은이 디렉터리 또는 페이지를 볼 수있는 권한이 없습니다"

나는

의 web.config, process.json,하는 index.js,

"start": "node index.js" 
package.json에

와 '푸른 모바일 서비스'플러그인을 추가했다.

진행률이 없습니다. 누군가가 도와 주실 수 있습니까? 감사합니다 ...

Simple ionic blank project

의 Web.config :

<configuration> 
<system.webServer> 
     <handlers> 
     <add name="iisnode" path="index.js" verb="*" modules="iisnode"/> 
     </handlers> 
     <rewrite> 
      <rules> 
       <rule name="SPA"> 
        <match url=".*" /> 
        <conditions logicalGrouping="MatchAll"> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
         <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="/" /> 
       </rule> 
      </rules> 
     </rewrite> 
</system.webServer> 
</configuration> 

process.json :

{ 
    "name": "worker", 
    "script": "./index.js", 
    "instances": 1, 
    "merge_logs": true, 
    "log_date_format": "YYYY-MM-DD HH:mm Z", 
    "watch": true, 
    "watch_options": { 
    "followSymlinks": true, 
    "usePolling": true, 
    "interval": 5 
    } 
} 

package.json :

{ 
    "name": "io.cordova.myappd3d469", 
    "author": "", 
    "homepage": "", 
    "private": true, 
    "scripts": { 
    "start": "node index.js", 
    "clean": "ionic-app-scripts clean", 
    "build": "ionic-app-scripts build", 
    "ionic:build": "ionic-app-scripts build", 
    "ionic:serve": "ionic-app-scripts serve", 
    "watch": "ionic-app-scripts watch" 
    }, 
    "dependencies": { 
    "@angular/common": "2.2.1", 
    "@angular/compiler": "2.2.1", 
    "@angular/compiler-cli": "2.2.1", 
    "@angular/core": "2.2.1", 
    "@angular/forms": "2.2.1", 
    "@angular/http": "2.2.1", 
    "@angular/platform-browser": "2.2.1", 
    "@angular/platform-browser-dynamic": "2.2.1", 
    "@angular/platform-server": "2.2.1", 
    "@ionic/storage": "1.1.7", 
    "ionic-angular": "2.0.1", 
    "ionic-native": "2.4.1", 
    "ionicons": "3.0.0", 
    "rxjs": "5.0.0-beta.12", 
    "sw-toolbox": "3.4.0", 
    "zone.js": "0.6.26" 
    }, 
    "devDependencies": { 
    "@ionic/app-scripts": "1.1.0", 
    "typescript": "2.0.9" 
    }, 
    "description": "Ionic2Blank: An Ionic project", 
    "cordovaPlugins": [ 
    "cordova-plugin-whitelist", 
    "cordova-plugin-console", 
    "cordova-plugin-statusbar", 
    "cordova-plugin-device", 
    "cordova-plugin-splashscreen", 
    "ionic-plugin-keyboard" 
    ], 
    "cordovaPlatforms": [], 
    "-vs-binding": { 
    "BeforeBuild": [ "ionic:build" ] 
    } 
} 

하는 index.js :

var http = require('http'); 

var server = http.createServer(function (request, response) { 

    response.writeHead(200, { "Content-Type": "text/plain" }); 
    response.end("Hello World!"); 

}); 

var port = process.env.PORT || 1337; 
server.listen(port); 

console.log("Server running at http://localhost:%d", port); 

푸른 웹 앱 설정 :

enter image description here

+0

당신이 당신의'web.config'의 전체 내용에 포함시겠습니까 질문? –

+0

좋아,하지만 www 폴더가 어떤 이유에서 루트 폴더라고 생각하고 기억 ... –

답변

0

당신은 대신 다음 web.config를 사용할 수 있습니다

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.webServer> 
     <handlers> 
      <add name="iisnode" path="index.js" verb="*" modules="iisnode" /> 
     </handlers> 
     <rewrite> 
      <rules> 
       <!-- First we consider whether the incoming URL matches a physical file in the /public folder --> 
       <rule name="StaticContent"> 
        <action type="Rewrite" url="public{REQUEST_URI}" /> 
       </rule> 
       <!-- All other URLs are mapped to the node.js site entry point --> 
       <rule name="DynamicContent"> 
        <conditions> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /> 
         <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="index.js" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 
+0

고마워,하지만 여전히 나에게 같은 오류를주는 ... –

+0

글쎄, 당신은 로컬로 Ionic2 애플 리케이션을 구축하고 컴파일 된 배포해야합니다 Azure Web App에 파일 저장. Azure Web Apps는'web.config' 파일없이 정적 파일을 제공 할 수있는 Microsoft IIS에서 실행되기 때문에 더 이상 Node.js 프로세스를 사용할 필요가 없습니다. –

+0

My Ionic2 Node.js 앱이 Visual Studio 2017에서 로컬로 실행되며 GitBash를 사용하여 azure 웹 앱 서비스에 성공적으로 푸시했습니다. –

관련 문제