azure app-service返回ERR_CONTENT_DECODING_FAILED

时间:2017-05-31 20:15:32

标签: node.js azure azure-web-sites http-error

我已将我的节点应用程序部署到azure但是获取所有方面此错误消息:ERR_CONTENT_DECODING_FAILED

我已经尝试了几件事,比如把它放到我的web.config

<urlCompression doStaticCompression="true" doDynamicCompression="true" />
    <httpCompression>
      <dynamicTypes>
        <clear />
        <add enabled="true" mimeType="text/*"/>
        <add enabled="true" mimeType="message/*"/>
        <add enabled="true" mimeType="application/x-javascript"/>
        <add enabled="true" mimeType="application/javascript"/>
        <add enabled="true" mimeType="application/json"/>
        <add enabled="false" mimeType="*/*"/>
        <add enabled="true" mimeType="application/atom+xml"/>
        <add enabled="true" mimeType="application/atom+xml;charset=utf-8"/>
      </dynamicTypes>
      <staticTypes>
        <clear />
        <add enabled="true" mimeType="text/*"/>
        <add enabled="true" mimeType="message/*"/>
        <add enabled="true" mimeType="application/javascript"/>
        <add enabled="true" mimeType="application/atom+xml"/>
        <add enabled="true" mimeType="application/xaml+xml"/>
        <add enabled="true" mimeType="application/json"/>
        <add enabled="false" mimeType="*/*"/>
      </staticTypes>
    </httpCompression>

但没有任何作用。 有人可以帮忙吗?

我部署的网站就是这个: https://github.com/aumanjoa/chronas-community

1 个答案:

答案 0 :(得分:1)

我将您的网站部署到Azure App Service。在应用设置中设置CLOUDINARY_URL值和mongo的连接字符串后,我收到如下错误。

enter image description here

这是我的web.config供参考。

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

<configuration>
     <system.webServer>
          <!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
          <webSocket enabled="false" />
          <handlers>
               <!-- Indicates that the app.js file is a node.js site to be handled by the iisnode module -->
               <add name="iisnode" path="keystone.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="^keystone.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="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"/>
                         </conditions>
                         <action type="Rewrite" url="keystone.js"/>
                    </rule>
               </rules>
          </rewrite>

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

          <httpErrors existingResponse="PassThrough" />

          <iisnode watchedFiles="web.config;*.js" debuggingEnabled="false" />
     </system.webServer>
</configuration>

显然,错误与您的错误不同。因此,在将应用程序部署到Azure之前,您可以确认应用程序是否在本地运行正常。另请注意,默认情况下启用gzip压缩而不进行任何操作。您可以查看Azure Web App Not Using GZip Compressiongzip compression in Windows Azure Websites了解详情。

相关问题