asp.net – 在Azure网站上启用gzip压缩
发布时间:2020-12-15 19:49:51 所属栏目:asp.Net 来源:网络整理
导读:我有一个使用标准层在azure网站上运行的ASP.NET应用程序.我一直试图让gzip压缩工作.我修改了我的web.config文件,并在system.webServer下添加了以下内容 urlCompression doStaticCompression="true" doDynamicCompression="true"/httpCompression directory="
我有一个使用标准层在azure网站上运行的ASP.NET应用程序.我一直试图让gzip压缩工作.我修改了我的web.config文件,并在system.webServer下添加了以下内容
<urlCompression doStaticCompression="true" doDynamicCompression="true"/> <httpCompression directory="%SystemDrive%inetpubtempIIS Temporary Compressed Files"> <dynamicTypes> <add mimeType="text/*" enabled="true"/> <add mimeType="message/*" enabled="true"/> <add mimeType="application/javascript" enabled="true"/> <add mimeType="application/x-javascript" enabled="true"/> <add mimeType="*/*" enabled="false"/> </dynamicTypes> <staticTypes> <add mimeType="text/*" enabled="true"/> <add mimeType="message/*" enabled="true"/> <add mimeType="application/javascript" enabled="true"/> <add mimeType="application/x-javascript" enabled="true"/> <add mimeType="*/*" enabled="false"/> </staticTypes> </httpCompression> 这在使用IIS express本地运行时有效,但在部署到azure时不起作用.响应包含以下标头. Accept-Ranges:bytes Content-Length:5381 Content-Type:text/css Date:Fri,04 Sep 2015 20:44:01 GMT ETag:"56386b2e88dad01:0" Last-Modified:Wed,19 Aug 2015 14:06:02 GMT Server:Microsoft-IIS/8.0 X-Powered-By:ASP.NET 解决方法
你错过了< scheme>元件
<scheme name="gzip" dll="%Windir%system32inetsrvgzip.dll" /> 更多信息: https://www.iis.net/configreference/system.webserver/httpcompression/scheme <urlCompression doStaticCompression="true" doDynamicCompression="true"/> <httpCompression directory="%SystemDrive%inetpubtempIIS Temporary Compressed Files"> <scheme name="gzip" dll="%Windir%system32inetsrvgzip.dll" /> <dynamicTypes> <add mimeType="text/*" enabled="true"/> <add mimeType="message/*" enabled="true"/> <add mimeType="application/javascript" enabled="true"/> <add mimeType="application/x-javascript" enabled="true"/> <add mimeType="*/*" enabled="false"/> </dynamicTypes> <staticTypes> <add mimeType="text/*" enabled="true"/> <add mimeType="message/*" enabled="true"/> <add mimeType="application/javascript" enabled="true"/> <add mimeType="application/x-javascript" enabled="true"/> <add mimeType="*/*" enabled="false"/> </staticTypes> </httpCompression> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 便携式区域与多个项目区域?
- asp.net – 从命令行包含项目中的文件
- 如何将ASP.NET MVC5身份认证添加到现有数据库
- asp.net-mvc – MVC会话过期而不是身份验证
- asp.net – SQL Server 2008架构更改的最佳实践
- ASP.NET bin目录中的Oracle oci.dll无法删除/不起作用
- 在HiddenField asp.net中存储一个字符串数组
- 如何使用ASP.NET MVC让jQuery.Ajax使用重定向执行正常的POS
- asp-classic – 使用FileSystemObject的文件权限 – CScrip
- asp.net-mvc-3 – Structuremap,AutoFac或Ninject,哪一个适
推荐文章
站长推荐
- asp.net – 当不匹配路由时,OWIN中的WebApi总是返
- 如何在ASP.NET中继器DataDataBound事件中访问数据
- asp-classic – 如何在Classic ASP中延迟响应
- asp.net – 如何构建专门的JQuery Timer
- ASP.NET:将值从用户控件传递到页面?
- asp.net-core – asp.net核心自定义模型绑定器,仅
- 单元测试 – 测试ASP.NET Web API多部分表单数据
- asp.net-mvc – 当内容包含PageControl或TabCont
- asp.net-identity – 使用asp.net身份在身份服务
- asp.net-mvc – 如何使用Autofac将控制器的Model
热点阅读