IIS 7.5没有COM pressing JSON当应用程序的web.config设置 [英] IIS 7.5 not compressing JSON when set in application web.config

查看:193
本文介绍了IIS 7.5没有COM pressing JSON当应用程序的web.config设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力使JSON COM pression从我们的MVC3网站之一。从各种文章我读过它好像我应该能够设置应用程序/ JSON;字符集= UTF-8 MIME类型的应用程序的web.config文件。但这样做并没有启用COM pression。但是,当添加到ApplicationHost.config文件,它的工作原理。我失去了一些东西呢?

I've been working on enabling JSON compression from one of our MVC3 sites. From various articles I've read it seems as though I should be able to set the application/json; charset=utf-8 MIME type in the applications web.config file. But doing so does not enable compression. But when added to the applicationhost.config file, it works. Am I missing something here?

我的应用程序的web.config有以下添加进去:

My application web.config has the following added to it:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
    <dynamicTypes>
        <add mimeType="application/javascript; charset=utf-8" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/json; charset=utf-8" enabled="true" />
    </dynamicTypes>
    <staticTypes>
        <add mimeType="application/javascript; charset=utf-8" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/json; charset=utf-8" enabled="true" />
    </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />

服务器运行Windows Server 2008 R2与IIS7.5。我还安装了与放大器;启用动态的COM pression为有问题的网站。

The server is running Windows Server 2008 R2 with IIS7.5. I've also installed & enabled Dynamic Compression for the site in question.

任何帮助将是很大的AP preciated,因为我不希望启用JSON COM pression为整个服务器。

Any help would be greatly appreciated, as I do not wish to enable JSON compression for the entire server.

推荐答案

HttpCom pression 部分定义 AppHostOnly 对ApplicationHost.config 其prevents你在web.config中设置其属性。

HttpCompression section is defined AppHostOnly in ApplicationHost.config which prevents you from setting its properties in web.config.

在COM pression模块读取只能从对ApplicationHost.config服务器级属性,所以即使你解开段( APPCMD overrideModeDefault =允许),在较低的水平设置将被忽略。

The compression module reads only the server level properties from 'ApplicationHost.config' so even if you unlock the section (with appcmd or overrideModeDefault="Allow"), settings on lower level will be ignored.

这篇关于IIS 7.5没有COM pressing JSON当应用程序的web.config设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆