iis7 压缩来自自定义处理程序的动态内容
我在获取来自自定义处理程序的动态内容并由 IIS 7 进行压缩时遇到问题。
我们的处理程序会输出 json 数据(内容类型:application/json;charset=utf-8)并响应类似于以下形式的 url:domain。 com/example.mal/OperationName?Param1=Val1&Param2=Val2
在 IIS 6 中,我们所要做的就是编辑 MetaBase.xml 并在 IIsCompressionScheme 元素中确保 HcScriptFileExtensions 属性具有自定义扩展名“mal”包含在其中。
静态和动态压缩是在服务器和网站级别进行的。 我可以确认正常的 .aspx 页面已正确压缩。 我唯一无法压缩的内容是来自自定义处理程序的内容。
我已尝试以下配置但没有成功:
<handlers>
<add name="MyJsonService" verb="GET,POST" path="*.mal" type="Library.Web.HttpHandlers.MyJsonServiceHandlerFactory, Library.Web" />
</handlers>
<httpCompression>
<dynamicTypes>
<add mimeType="application/json" enabled="true" />
</dynamicTypes>
</httpCompression>
_
<httpCompression>
<dynamicTypes>
<add mimeType="application/*" enabled="true" />
</dynamicTypes>
</httpCompression>
_
<staticContent>
<mimeMap fileExtension=".mal" mimeType="application/json" />
</staticContent>
<httpCompression>
<dynamicTypes>
<add mimeType="application/*" enabled="true" />
</dynamicTypes>
</httpCompression>
提前感谢您的帮助。
I am having trouble getting dynamic content coming from a custom handler to be compressed by IIS 7.
Our handler spits out json data (Content-Type: application/json; charset=utf-8) and responds to url that looks like: domain.com/example.mal/OperationName?Param1=Val1&Param2=Val2
In IIS 6, all we had to do was put the edit the MetaBase.xml and in the IIsCompressionScheme element make sure that the HcScriptFileExtensions attribute had the custom extension 'mal' included in it.
Static and Dynamic compression is turned out at the server and website level.
I can confirm that normal .aspx pages are compressed correctly.
The only content I cannot have compressed is the content coming from the custom handler.
I have tried the following configs with no success:
<handlers>
<add name="MyJsonService" verb="GET,POST" path="*.mal" type="Library.Web.HttpHandlers.MyJsonServiceHandlerFactory, Library.Web" />
</handlers>
<httpCompression>
<dynamicTypes>
<add mimeType="application/json" enabled="true" />
</dynamicTypes>
</httpCompression>
_
<httpCompression>
<dynamicTypes>
<add mimeType="application/*" enabled="true" />
</dynamicTypes>
</httpCompression>
_
<staticContent>
<mimeMap fileExtension=".mal" mimeType="application/json" />
</staticContent>
<httpCompression>
<dynamicTypes>
<add mimeType="application/*" enabled="true" />
</dynamicTypes>
</httpCompression>
Thanks in advance for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这是 IIS 压缩中的一个错误。
我需要将以下行添加到 applicationHost.config 文件(在 httpCompression 下)而不是 web.config
从这里找到了一些额外的帮助: http://forums.iis.net/p/1162828/1925766.aspx
looks like it is a bug in the IIS compression.
I needed to add the following line to the applicationHost.config file (under httpCompression ) instead of the web.config
found some extra help from here: http://forums.iis.net/p/1162828/1925766.aspx