2017-03-15 27 views
0

我在Visual Studio 2017企業版中使用項目模板「Basic Azure Node.js Express 4 Application」創建項目。內部服務器錯誤500,從Azure的Visual Studio 2017託管Node.js Express 4應用程序模板

enter image description here

當我在本地運行它,它工作正常。 現在,我使用下面的Publish菜單發佈此天青:

enter image description here

我得到以下錯誤:

iisnode encountered an error when processing the request. 

HRESULT: 0x2 
HTTP status: 500 
HTTP subStatus: 1001 
HTTP reason: Internal Server Error 

enter image description here

我作出任何更改代碼模板。

任何想法?

回答

1

我在Visual Studio 2017社區版中遵循了您的步驟。當我將快速應用發佈到Azure Web App時,我的瀏覽器出現以下錯誤。

The page cannot be displayed because an internal server error has occurred.

經過一番調查,我固定它由Web.config文件更改爲這樣的事情:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <system.webServer> 
    <staticContent> 
     <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> 
    </staticContent> 
    <modules runAllManagedModulesForAllRequests="false" /> 

    <iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug" /> 

    <handlers> 
     <add name="iisnode" path="bin/www" verb="*" modules="iisnode" /> 
    </handlers> 

    <rewrite> 
     <rules> 
     <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> 
      <match url="^bin/www\/debug[\/]?" /> 
     </rule> 
     <rule name="StaticContent"> 
      <action type="Rewrite" url="public{REQUEST_URI}" /> 
     </rule> 
     <rule name="DynamicContent"> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /> 
      </conditions> 
      <action type="Rewrite" url="bin/www" /> 
     </rule> 
     </rules> 
    </rewrite> 

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

    </system.webServer> 

</configuration>  

此外,web.config文件可以在https://github.com/projectkudu/kudu/wiki/Using-a-custom-web.config-for-Node-apps找到。

希望這會幫助你。

+0

謝謝。這解決了我的問題。歡呼亞蘭。 – Aram