2017-02-26 8 views
0

Azure Web AppのNodeJsでReact.jsアプリケーションを動作させようとしています。 アプリはローカルでは問題なく動作しますが、Azureではすべてのファイルに対して同じ内容が返されます。azureのReact.js + node.js

アプリは、主に3つのファイルがあります開くときにローカル

  • のindex.html(このファイルは、他の2を参照)
  • bundle.js
  • Styles.cssを

をappで、index.htmlは他の2つのファイルと共に提供されます。それぞれに正しい内容があります。アズールで

、代わりに、bundle.jsとStyles.cssをがindex.htmlを

のコンテンツを有するノードアプリは、この関連の構成を有している:

app.use(express.static('dist')); 

app.get('*', function(req, res) { 
    res.sendFile(path.join(__dirname, '../dist/index.html')); 
}); 

アズールにweb.configファイルでありますアプリケーションによって生成された通常のもの。私はそれと一緒に遊んだが、問題を回避することはできなかった。

web.configは、bundle.jsとstyless.cssがパブリックファイルであることを認識し、適切な要求をノードの魔法使いに送信して、上記の静的設定でそれらを提供する必要があります。 index.htmlは、ページのリフレッシュが実際に機能するように、任意のURLに対して提供されます。

ここで私が迷っていることを教えてください。

<handlers> 
    <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module --> 
    <add name="iisnode" path="bin/app.js" verb="*" modules="iisnode"/> 
</handlers> 
<rewrite> 
    <rules> 
    <!-- Do not interfere with requests for node-inspector debugging --> 
    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> 
     <match url="^bin/app.js\/debug[\/]?" /> 
    </rule> 

    <!-- First we consider whether the incoming URL matches a physical file in the /public folder --> 
    <rule name="StaticContent"> 
     <action type="Rewrite" url="dist{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"/> 
     </conditions> 
     <action type="Rewrite" url="bin/app.js"/> 
    </rule> 
    </rules> 
</rewrite> 

ありがとう:ここ

もweb.configファイルの関連部分です!

答えて

0

今晩試す最後のものとしてbinフォルダを削除しました。出来た!

問題はおそらく正規表現(bin/app.js)の "/"文字だった... :(

関連する問題