【问题标题】:azure app-service returning ERR_CONTENT_DECODING_FAILED天蓝色应用服务返回 ERR_CONTENT_DECODEDING_FAILED
【发布时间】:2017-11-01 19:09:55
【问题描述】:

我已将我的节点应用程序部署到 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

【问题讨论】:

    标签: node.js azure azure-web-app-service http-error


    【解决方案1】:

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

    这是我的 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

    【讨论】:

    • 感谢您的努力。我想我在我的 webapp 中配置了一些错误的东西。我用新的又试了一次,现在可以了
    猜你喜欢
    • 2018-09-07
    • 2018-12-12
    • 2017-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-26
    • 2017-03-21
    • 1970-01-01
    相关资源
    最近更新 更多