<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>简单生活 -- Kevin Yang的博客 &#187; 疑难杂症</title>
	<atom:link href="http://www.imkevinyang.com/categories/techarticles/knottyproblems/feed" rel="self" type="application/rss+xml" />
	<link>http://www.imkevinyang.com</link>
	<description>It&#039;s all about sharing</description>
	<lastBuildDate>Sun, 05 Feb 2012 15:37:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>解决新创建的windows用户无法访问TFS的问题</title>
		<link>http://www.imkevinyang.com/2011/05/%e8%a7%a3%e5%86%b3%e6%96%b0%e5%88%9b%e5%bb%ba%e7%9a%84windows%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%aetfs%e7%9a%84%e9%97%ae%e9%a2%98.html</link>
		<comments>http://www.imkevinyang.com/2011/05/%e8%a7%a3%e5%86%b3%e6%96%b0%e5%88%9b%e5%bb%ba%e7%9a%84windows%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%aetfs%e7%9a%84%e9%97%ae%e9%a2%98.html#comments</comments>
		<pubDate>Thu, 12 May 2011 14:37:52 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[administrator]]></category>
		<category><![CDATA[IIS应用程序池]]></category>
		<category><![CDATA[TFS]]></category>
		<category><![CDATA[windows用户]]></category>
		<category><![CDATA[无法访问]]></category>
		<category><![CDATA[权限]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2011/05/%e8%a7%a3%e5%86%b3%e6%96%b0%e5%88%9b%e5%bb%ba%e7%9a%84windows%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%aetfs%e7%9a%84%e9%97%ae%e9%a2%98.html</guid>
		<description><![CDATA[<p>TFS在安装完成之后会创建一个&#34;Builtin\Administrators&#34;组，可以管理TFS。从名字上来看，这个组应该是映射到windows的administrators组。看里头的成员清单，确实也是windows所有管理员帐号成员。</p>
<p>但是有时候新建一个windows管理员账号&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>TFS在安装完成之后会创建一个&quot;Builtin\Administrators&quot;组，可以管理TFS。从名字上来看，这个组应该是映射到windows的administrators组。看里头的成员清单，确实也是windows所有管理员帐号成员。</p>
<p>但是有时候新建一个windows管理员账号的时候，这个账号却无法连接上TFS，总是提示没有权限，过几天又突然可以访问，就没搭理这个问题。后来一次出问题的时候，我无意中检查了一下&quot;Builtin\Administrators&quot;组的成员，发现新建的用户竟然没有在里面！看来，这个组虽然是映射到windows的administrators组，但是并不是实时刷新的。</p>
<p>找到问题所在，那解决思路就是让TFS强制刷新这个分组即可。<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">google</a>了一下，似乎没有这样的命令行。想到IIS中有一个TFS应用程序，客户端就是通过HTTP来访问TFS的，重启这个应用程序应该可以达到效果。找到TFS对应的应用程序池，回收之，再看回&quot;Builtin\administrators&quot;组，新建的用户果然有了，也可以正常访问TFS了。</p>
<p>希望此文对你有帮助~</p>
<p>== <a style="font-family: comic sans ms; color: black; font-weight: bold; text-decoration: none" title="解决新创建的windows用户无法访问TFS的问题" href="http://www.imkevinyang.com/2011/05/%e8%a7%a3%e5%86%b3%e6%96%b0%e5%88%9b%e5%bb%ba%e7%9a%84windows%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%aeTFS%e7%9a%84%e9%97%ae%e9%a2%98.html" target="_self">Kevin Yang</a> == </p>

	标签：<a href="http://www.imkevinyang.com/tags/administrator" title="administrator" rel="tag">administrator</a>, <a href="http://www.imkevinyang.com/tags/iis%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e6%b1%a0" title="IIS应用程序池" rel="tag">IIS应用程序池</a>, <a href="http://www.imkevinyang.com/tags/tfs" title="TFS" rel="tag">TFS</a>, <a href="http://www.imkevinyang.com/tags/windows%e7%94%a8%e6%88%b7" title="windows用户" rel="tag">windows用户</a>, <a href="http://www.imkevinyang.com/tags/%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%ae" title="无法访问" rel="tag">无法访问</a>, <a href="http://www.imkevinyang.com/tags/%e6%9d%83%e9%99%90" title="权限" rel="tag">权限</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2011/01/tfs%e6%97%a0%e6%b3%95%e5%88%9b%e5%bb%ba%e6%96%b0%e7%9a%84team-project.html" title="TFS无法创建新的Team Project (2011/01/04)">TFS无法创建新的Team Project</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/12/win7vista%e9%ab%98%e7%ba%a7%e7%94%a8%e6%88%b7%e5%bf%85%e5%a4%87%e7%9a%84%e5%8f%b3%e9%94%ae%e8%8f%9c%e5%8d%95take-back-my-ownership.html" title="Win7/Vista高级用户必备的右键菜单Take back my Ownership! (2009/12/06)">Win7/Vista高级用户必备的右键菜单Take back my Ownership!</a> </li>
	<li><a href="http://www.imkevinyang.com/2011/06/%e5%8d%87%e7%ba%a7tfs-2010%e4%b9%8b%e5%90%8e%e4%bf%ae%e5%a4%8d%e5%8e%9f%e6%9c%89%e5%b7%a5%e4%bd%9c%e5%8c%ba.html" title="升级TFS 2010之后修复原有工作区 (2011/06/17)">升级TFS 2010之后修复原有工作区</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/%e6%9d%83%e9%99%90%e5%af%bc%e8%87%b4%e7%9a%84analysis%e6%80%a7%e8%83%bd%e8%ae%a1%e6%95%b0%e5%99%a8%e5%9c%a8vistawin2008%e4%b8%8b%e5%a4%b1%e6%95%88%e7%9a%84%e9%97%ae%e9%a2%98.html" title="权限不足导致的Analysis性能计数器在Vista/win2008下失效的问题 (2009/11/12)">权限不足导致的Analysis性能计数器在Vista/win2008下失效的问题</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/03/%e8%ae%a9team-foundation-server-client%ef%bc%88tfs%ef%bc%89%e8%83%bd%e6%af%94%e8%be%83%e5%92%8c%e5%90%88%e5%b9%b6word%e6%96%87%e6%a1%a3.html" title="让Team Foundation Server Client（TFS）能比较和合并Word文档 (2010/03/29)">让Team Foundation Server Client（TFS）能比较和合并Word文档</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2011/05/%e8%a7%a3%e5%86%b3%e6%96%b0%e5%88%9b%e5%bb%ba%e7%9a%84windows%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%aetfs%e7%9a%84%e9%97%ae%e9%a2%98.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TFS无法创建新的Team Project</title>
		<link>http://www.imkevinyang.com/2011/01/tfs%e6%97%a0%e6%b3%95%e5%88%9b%e5%bb%ba%e6%96%b0%e7%9a%84team-project.html</link>
		<comments>http://www.imkevinyang.com/2011/01/tfs%e6%97%a0%e6%b3%95%e5%88%9b%e5%bb%ba%e6%96%b0%e7%9a%84team-project.html#comments</comments>
		<pubDate>Tue, 04 Jan 2011 15:24:51 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[Reporting Service]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[Team Project]]></category>
		<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2011/01/tfs%e6%97%a0%e6%b3%95%e5%88%9b%e5%bb%ba%e6%96%b0%e7%9a%84team-project.html</guid>
		<description><![CDATA[<p>今天又遭遇了TFS无法创建Team Project的问题。记得上次出现过一次，但是忘记怎么解决来着了。所以说应该花点时间把问题记录一下的嘛 o(︶︿︶)o </p>
<p>服务器的系统环境是Team foundation server 2008+windows server 2008+Sql Server 2005+VS sp1。创建到&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>今天又遭遇了TFS无法创建Team Project的问题。记得上次出现过一次，但是忘记怎么解决来着了。所以说应该花点时间把问题记录一下的嘛 o(︶︿︶)o </p>
<p>服务器的系统环境是Team foundation server 2008+windows server 2008+Sql Server 2005+VS sp1。创建到最后一步的时候提示错误，说是创建Reporting Site的时候出的问题，让我检查权限是否配置正确云云。我确认了一下我登录TFS使用的是administrator账户，而且此账号在Sharepoint上的权限已经是content manager了，应该不是这个问题。打开TFS的异常日志，看到如下的错误信息：</p>
<blockquote><p>Event Description: TF30207: Initialization for plugin &quot;Microsoft.ProjectCreationWizard.Reporting&quot; failed      <br />Exception Type: Microsoft.TeamFoundation.Client.PcwException       <br />Exception Message: TF30224: Failed to retrieve projects from the report server. Please check that the SQL Server Reporting Services Web and Windows services are running and you have sufficient privileges for creating a project.       <br />Exception Details: The Project Creation Wizard encountered a problem while       <br />creating reports on the SQL Server Reporting Services on GS-CONFIGSERVER.       <br />The reason for the failure cannot be determined at this time.       <br />Because the operation failed, the wizard was not able to finish       <br />creating the SQL Server Reporting Services site.       <br />Stack Trace:       <br />&#160;&#160; 在 Microsoft.VisualStudio.TeamFoundation.RosettaReportUploader.CheckForProjectFolder(PrivateData data, String projectName, ProjectCreationContext context)       <br />&#160;&#160; 在 Microsoft.VisualStudio.TeamFoundation.RosettaReportUploader.Initialize(ProjectCreationContext context)       <br />&#160;&#160; 在 Microsoft.VisualStudio.TeamFoundation.EngineStarter.InitializePlugins(MsfTemplate template, PcwPluginCollection pluginCollection)       <br />--&#160;&#160; Inner Exception&#160;&#160; --       <br />Exception Type: System.Web.Services.Protocols.SoapException       <br />Exception Message: 服务器未能识别 HTTP 头 SOAPAction 的值: <a href="http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListChildren。">http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListChildren。</a>       <br />SoapException Details: &lt;detail /&gt;       <br />Stack Trace:       <br />&#160;&#160; 在 System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)       <br />&#160;&#160; 在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)       <br />&#160;&#160; 在 Microsoft.TeamFoundation.Proxy.Reporting.ReportingService.ListChildren(String Item, Boolean Recursive)       <br />&#160;&#160; 在 Microsoft.VisualStudio.TeamFoundation.RosettaReportUploader.CheckForProjectFolder(PrivateData data, String projectName, ProjectCreationContext context)       <br />-- end Inner Exception --       <br />--- end Exception entry ---</p>
</blockquote>
<p><a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a>了很久终于找到有用的信息。大意就是说，<strong>TFS内部维护着一堆web service的Url，用于访问Reporting Service、Sharepoint等服务。但是TFS 2008内部维护的Url使用的web service接口却是已经废弃了的Sql Server 2000的Reporting Service的接口。</strong></p>
<p>修改步骤：</p>
<p>1. 命令行切换到&quot;TFS安装目录/Tools&quot;下</p>
<p>2. 运行命令：tfsreg /export tfsreg.xml 服务器机器名（先导出当前配置）</p>
<p>3. 用记事本打开tfsreg.xml文件，找到reportservice.asmx，将其改成reportservice2005.asmx</p>
<p>4. 运行命令：tfsreg /overwrite tfsreg.xml 服务器机器名（更新配置）</p>
<p>如果还是不行可能是缓存缘故，可以重启机器试试。</p>
<p>Mark一下。</p>
<p>== <a style="font-family: comic sans ms; color: black; font-weight: bold" title="TFS无法创建新的Team Project" href="http://www.imkevinyang.com/2011/01/TFS%e6%97%a0%e6%b3%95%e5%88%9b%e5%bb%ba%e6%96%b0%e7%9a%84Team%20Project.html" target="_self">Kevin Yang</a> == </p>

	标签：<a href="http://www.imkevinyang.com/tags/reporting-service" title="Reporting Service" rel="tag">Reporting Service</a>, <a href="http://www.imkevinyang.com/tags/sharepoint" title="Sharepoint" rel="tag">Sharepoint</a>, <a href="http://www.imkevinyang.com/tags/team-project" title="Team Project" rel="tag">Team Project</a>, <a href="http://www.imkevinyang.com/tags/tfs" title="TFS" rel="tag">TFS</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2011/06/%e5%8d%87%e7%ba%a7tfs-2010%e4%b9%8b%e5%90%8e%e4%bf%ae%e5%a4%8d%e5%8e%9f%e6%9c%89%e5%b7%a5%e4%bd%9c%e5%8c%ba.html" title="升级TFS 2010之后修复原有工作区 (2011/06/17)">升级TFS 2010之后修复原有工作区</a> </li>
	<li><a href="http://www.imkevinyang.com/2011/05/%e8%a7%a3%e5%86%b3%e6%96%b0%e5%88%9b%e5%bb%ba%e7%9a%84windows%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%aetfs%e7%9a%84%e9%97%ae%e9%a2%98.html" title="解决新创建的windows用户无法访问TFS的问题 (2011/05/12)">解决新创建的windows用户无法访问TFS的问题</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/03/%e8%ae%a9team-foundation-server-client%ef%bc%88tfs%ef%bc%89%e8%83%bd%e6%af%94%e8%be%83%e5%92%8c%e5%90%88%e5%b9%b6word%e6%96%87%e6%a1%a3.html" title="让Team Foundation Server Client（TFS）能比较和合并Word文档 (2010/03/29)">让Team Foundation Server Client（TFS）能比较和合并Word文档</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2011/01/tfs%e6%97%a0%e6%b3%95%e5%88%9b%e5%bb%ba%e6%96%b0%e7%9a%84team-project.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Win7管理无线网络变成小图标了</title>
		<link>http://www.imkevinyang.com/2011/01/win7%e7%ae%a1%e7%90%86%e6%97%a0%e7%ba%bf%e7%bd%91%e7%bb%9c%e5%8f%98%e6%88%90%e5%b0%8f%e5%9b%be%e6%a0%87%e4%ba%86.html</link>
		<comments>http://www.imkevinyang.com/2011/01/win7%e7%ae%a1%e7%90%86%e6%97%a0%e7%ba%bf%e7%bd%91%e7%bb%9c%e5%8f%98%e6%88%90%e5%b0%8f%e5%9b%be%e6%a0%87%e4%ba%86.html#comments</comments>
		<pubDate>Mon, 03 Jan 2011 17:00:30 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[Win7]]></category>
		<category><![CDATA[图标]]></category>
		<category><![CDATA[管理无线网络]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2011/01/win7%e7%ae%a1%e7%90%86%e6%97%a0%e7%ba%bf%e7%bd%91%e7%bb%9c%e5%8f%98%e6%88%90%e5%b0%8f%e5%9b%be%e6%a0%87%e4%ba%86.html</guid>
		<description><![CDATA[<p>win7经常有一些莫名其妙的小问题。某天打开网络中心的“管理无线网络”，结果发现显示的都是小图标。根本不知道哪个图标对应哪个无线网络。右键的查看菜单变灰了，也无法修改。</p>
<p></p>
<p>看遍所有菜单项没有找到可以改动的地方，<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a>也没找到解决方法，就一直保持这样了。</p>
<p>后来有一次打开文件夹选项的时候，看到有个“重置&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>win7经常有一些莫名其妙的小问题。某天打开网络中心的“管理无线网络”，结果发现显示的都是小图标。根本不知道哪个图标对应哪个无线网络。右键的查看菜单变灰了，也无法修改。</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="管理无线网络" src="http://www.imkevinyang.com/wp-content/uploads/2011/01/image.png" border="0" alt="管理无线网络控制面板中变成小图标了" width="227" height="244" /></p>
<p>看遍所有菜单项没有找到可以改动的地方，<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a>也没找到解决方法，就一直保持这样了。</p>
<p>后来有一次打开文件夹选项的时候，看到有个“重置文件夹”的按钮，突然联想到这个问题，点了一下，再到无线网络中心一看，居然恢复正常了。</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="文件夹选项" src="http://www.imkevinyang.com/wp-content/uploads/2011/01/image1.png" border="0" alt="文件夹选项中重置文件夹可以修复此问题" width="244" height="186" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="网络中心" src="http://www.imkevinyang.com/wp-content/uploads/2011/01/image2.png" border="0" alt="恢复正常的无线网络中心" width="244" height="89" /></p>
<p style="text-align: right;"><em><strong><span style="font-family: 'Comic Sans MS';"><a href="http://www.imkevinyang.com/2011/01/win7%E7%AE%A1%E7%90%86%E6%97%A0%E7%BA%BF%E7%BD%91%E7%BB%9C%E5%8F%98%E6%88%90%E5%B0%8F%E5%9B%BE%E6%A0%87%E4%BA%86.html" target="_self">——Kevin Yang</a></span></strong></em></p>

	标签：<a href="http://www.imkevinyang.com/tags/win7" title="Win7" rel="tag">Win7</a>, <a href="http://www.imkevinyang.com/tags/%e5%9b%be%e6%a0%87" title="图标" rel="tag">图标</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a>, <a href="http://www.imkevinyang.com/tags/%e7%ae%a1%e7%90%86%e6%97%a0%e7%ba%bf%e7%bd%91%e7%bb%9c" title="管理无线网络" rel="tag">管理无线网络</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2009/12/win7vista%e9%ab%98%e7%ba%a7%e7%94%a8%e6%88%b7%e5%bf%85%e5%a4%87%e7%9a%84%e5%8f%b3%e9%94%ae%e8%8f%9c%e5%8d%95take-back-my-ownership.html" title="Win7/Vista高级用户必备的右键菜单Take back my Ownership! (2009/12/06)">Win7/Vista高级用户必备的右键菜单Take back my Ownership!</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/07/win7%e8%ae%bf%e9%97%ae%e8%bf%9c%e7%a8%8b%e6%a1%8c%e9%9d%a2%e6%9c%80%e5%a4%a7%e5%8c%96%e5%90%8c%e6%97%b6%e8%ae%a9%e4%bb%bb%e5%8a%a1%e6%a0%8f%e5%8f%af%e8%a7%81.html" title="Win7访问远程桌面最大化同时让任务栏可见 (2010/07/03)">Win7访问远程桌面最大化同时让任务栏可见</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/%e8%a7%a3%e5%86%b3win7%e4%b8%8bie8%e5%bc%80%e5%8f%91%e4%ba%ba%e5%91%98%e5%b7%a5%e5%85%b7%e7%aa%97%e5%8f%a3%e6%b6%88%e5%a4%b1%e7%9a%84%e9%97%ae%e9%a2%98.html" title="解决Win7下IE8开发人员工具打不开的问题 (2009/11/13)">解决Win7下IE8开发人员工具打不开的问题</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2011/01/win7%e7%ae%a1%e7%90%86%e6%97%a0%e7%ba%bf%e7%bd%91%e7%bb%9c%e5%8f%98%e6%88%90%e5%b0%8f%e5%9b%be%e6%a0%87%e4%ba%86.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>IE无法设置短域名下Cookie</title>
		<link>http://www.imkevinyang.com/2010/09/ie%e6%97%a0%e6%b3%95%e8%ae%be%e7%bd%ae%e7%9f%ad%e5%9f%9f%e5%90%8d%e4%b8%8bcookie.html</link>
		<comments>http://www.imkevinyang.com/2010/09/ie%e6%97%a0%e6%b3%95%e8%ae%be%e7%bd%ae%e7%9f%ad%e5%9f%9f%e5%90%8d%e4%b8%8bcookie.html#comments</comments>
		<pubDate>Mon, 06 Sep 2010 08:00:00 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[Cookie]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[流量监测]]></category>
		<category><![CDATA[短域名]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2010/09/ie%e6%97%a0%e6%b3%95%e8%ae%be%e7%bd%ae%e7%9f%ad%e5%9f%9f%e5%90%8d%e4%b8%8bcookie.html</guid>
		<description><![CDATA[<p>最近客户在使用我们的流量监测系统以及GA时发现了一个问题，我们统计到的数据比GA的要多很多倍，而且我们统计到的数据中，跳出率非常高，高达99%左右。</p>
<p>在经过一番简单排查之后找到了问题所在，Cookie设置失败。</p>
<p>但至于为什么会失败，这个问题查了半天，最后在StackOverflow上面有人提到了，IE从&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>最近客户在使用我们的流量监测系统以及GA时发现了一个问题，我们统计到的数据比GA的要多很多倍，而且我们统计到的数据中，跳出率非常高，高达99%左右。</p>
<p>在经过一番简单排查之后找到了问题所在，Cookie设置失败。</p>
<p>但至于为什么会失败，这个问题查了半天，最后在StackOverflow上面有人提到了，IE从5.0开始就无法为短域名下设置Cookie。</p>
<p>那么多短才会出现问题呢？经过试验，发现包含点号在内一共<strong>5个字符以内包括5个字符</strong>都无法通过Javascript设置Cookie，不过这里有个前提，就是只有当你设置Cookie时显式指定了domain参数才会失败。也就是说如果你这么写：</p>
<pre class="brush: js">document.cookie=&quot;key=value;domain=ab.cn&quot;;</pre>
<p>Cookie设置会失败，如果去掉domain参数，直接这样写：</p>
<pre class="brush: js">document.cookie=&quot;key=value&quot;;</pre>
<p>则不会出现这样的问题，即便当前域依然是ab.cn。</p>
<p>这篇文章<a title="http://support.microsoft.com/kb/310676/en-us/" href="http://support.microsoft.com/kb/310676/en-us/">http://support.microsoft.com/kb/310676/en-us/</a>提到了类似的问题，不过貌似和这个情况不大一样。大家也可以参考一下。</p>
<p>因为Cookie设置失败，导致我们的流量监测系统认为每个访问都是一次新的访问，自然跳出率就极高了，而GA貌似Cookie设置失败就不发数据了。</p>
<p>Firefox和Chrome没有这样的问题。</p>
<p>Mark一下，希望对遇到类似问题的人有帮助。</p>
<p style="text-align: right">——<a title="IE无法设置短域名下Cookie" href="http://www.imkevinyang.com/2010/09/IE%e6%97%a0%e6%b3%95%e8%ae%be%e7%bd%ae%e7%9f%ad%e5%9f%9f%e5%90%8d%e4%b8%8bCookie.html"><em>Kevin Yang</em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/cookie" title="Cookie" rel="tag">Cookie</a>, <a href="http://www.imkevinyang.com/tags/ie" title="IE" rel="tag">IE</a>, <a href="http://www.imkevinyang.com/tags/%e6%b5%81%e9%87%8f%e7%9b%91%e6%b5%8b" title="流量监测" rel="tag">流量监测</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a>, <a href="http://www.imkevinyang.com/tags/%e7%9f%ad%e5%9f%9f%e5%90%8d" title="短域名" rel="tag">短域名</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2009/03/ie%e4%b8%ad%e4%bd%bf%e7%94%a8windowopen%e6%89%93%e5%bc%80%e6%96%b0%e7%aa%97%e5%8f%a3%e6%97%b6%e6%97%a0%e6%b3%95%e8%8e%b7%e5%8f%96referrer%e5%af%b9%e8%b1%a1.html" title="IE中使用window.open打开新窗口时无法获取Referrer对象 (2009/03/07)">IE中使用window.open打开新窗口时无法获取Referrer对象</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/06/javascript%e6%93%8d%e7%ba%b5cookie.html" title="Javascript操纵Cookie (2009/06/11)">Javascript操纵Cookie</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/05/%e5%bd%93google-analytics%e3%80%81firefox%e5%92%8ciis%e8%b5%b0%e5%88%b0%e4%ba%86%e4%b8%80%e8%b5%b7.html" title="当Google Analytics、Firefox和IIS走到了一起&#8230; (2010/05/29)">当Google Analytics、Firefox和IIS走到了一起&#8230;</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/02/%e5%bd%93%e5%89%8d%e6%97%a5%e6%9c%9f110%e5%b9%b4.html" title="当前日期110年 (2010/02/12)">当前日期110年</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/%e6%9c%80%e7%b2%be%e7%ae%80%e7%9a%84%e5%88%a4%e5%88%abie%e7%9a%84javascript%e4%bb%a3%e7%a0%81.html" title="最精简的判别IE的Javascript代码 (2009/03/23)">最精简的判别IE的Javascript代码</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/09/%e6%b5%81%e6%b0%93%e7%9a%84%e8%81%94%e9%80%9a%ef%bc%8c%e9%84%99%e8%a7%86%e4%b9%8b.html" title="流氓的联通，鄙视之 (2010/09/28)">流氓的联通，鄙视之</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/%e8%a7%a3%e5%86%b3win7%e4%b8%8bie8%e5%bc%80%e5%8f%91%e4%ba%ba%e5%91%98%e5%b7%a5%e5%85%b7%e7%aa%97%e5%8f%a3%e6%b6%88%e5%a4%b1%e7%9a%84%e9%97%ae%e9%a2%98.html" title="解决Win7下IE8开发人员工具打不开的问题 (2009/11/13)">解决Win7下IE8开发人员工具打不开的问题</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/%e8%a7%a3%e6%9e%90ie%e4%b8%ad%e7%9a%84javascript-error%e5%af%b9%e8%b1%a1.html" title="解析IE中的Javascript Error对象 (2010/01/17)">解析IE中的Javascript Error对象</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/09/ie%e6%97%a0%e6%b3%95%e8%ae%be%e7%bd%ae%e7%9f%ad%e5%9f%9f%e5%90%8d%e4%b8%8bcookie.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>当Google Analytics、Firefox和IIS走到了一起&#8230;</title>
		<link>http://www.imkevinyang.com/2010/05/%e5%bd%93google-analytics%e3%80%81firefox%e5%92%8ciis%e8%b5%b0%e5%88%b0%e4%ba%86%e4%b8%80%e8%b5%b7.html</link>
		<comments>http://www.imkevinyang.com/2010/05/%e5%bd%93google-analytics%e3%80%81firefox%e5%92%8ciis%e8%b5%b0%e5%88%b0%e4%ba%86%e4%b8%80%e8%b5%b7.html#comments</comments>
		<pubDate>Sat, 29 May 2010 10:25:09 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[Bad Request]]></category>
		<category><![CDATA[Cookie]]></category>
		<category><![CDATA[Fiddler]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[WFetch]]></category>
		<category><![CDATA[中文]]></category>
		<category><![CDATA[非法请求]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2010/05/%e5%bd%93google-analytics%e3%80%81firefox%e5%92%8ciis%e8%b5%b0%e5%88%b0%e4%ba%86%e4%b8%80%e8%b5%b7.html</guid>
		<description><![CDATA[<p>今天同事在投放AdWords广告的时候发现了一个诡异的现象：</p>
<blockquote><p>使用Firefox点击AdWords广告跳转到客户网站上之后，再次刷新页面或者浏览其他页面均提示“Bad Request”的HTTP错误（错误码400）。</p>
<p>而IE、Chrome下则没有这个问题。</p></blockquote>
Cookie惹的祸
<p>由于HTTP本身是无状态的，用来&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>今天同事在投放AdWords广告的时候发现了一个诡异的现象：</p>
<blockquote><p>使用Firefox点击AdWords广告跳转到客户网站上之后，再次刷新页面或者浏览其他页面均提示“Bad Request”的HTTP错误（错误码400）。</p>
<p>而IE、Chrome下则没有这个问题。</p></blockquote>
<h2>Cookie惹的祸</h2>
<p>由于HTTP本身是无状态的，用来实现状态维持的技术一般都是Cookie。而之前我也遇到过几次因为Cookie导致的访问异常。一次是同事用Firefox死活访问不了新东方网站（参见我之前的文章：<a href="http://www.imkevinyang.com/2009/07/firefox%E6%97%A0%E6%B3%95%E8%AE%BF%E9%97%AE%E7%89%B9%E5%AE%9A%E7%BD%91%E7%AB%99.html">Firefox无法访问特定网站</a>），一次是我自己死活登录不了Gmail帐号。这两个问题最终都是以清空Cookie解决的。所以这次有经验了，用web developer bar查看当前客户网站下都有哪些Cookie，一瞄，发现一个带乱码的Cookie。</p>
<p><img style="display: inline; border-width: 0px;" title="GA的乱码Cookie" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image12.png" border="0" alt="GA的乱码Cookie" width="344" height="33" /></p>
<p>不用想，也知道这是因为中文没有编码就直接塞到Cookie里头导致的乱码。看看Cookie的来头，__utmz，是<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a> Analytics（GA）植入的。删除此Cookie之后，访问正常。</p>
<h2><a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a> Analytics的Cookie编码问题</h2>
<p>同事测试的那个广告的Url添加了<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a> Analytics支持的跟踪参数，并且客户网站上也部署了GA的代码。</p>
<p>GA在执行时会检测当前Url中是否包含广告跟踪参数（至少必须包含utm_source），一旦发现，则认为是付费流量，这个时候它就会提取广告信息中的来源（utm_source），广告系列（utm_campaign）和广告媒介（utm_medium），对其进行解码（先尝试用decodeURIComponent函数，失败的话再用unescape函数），最后持久化存储到__utmz这个Cookie中。但是就在<strong><span style="color: #008000;">写入Cookie这一步，GA漏掉了编码操作</span></strong>。也就是说，如果我们的广告系列或者广告媒介的原始信息包含中文，那么GA就会直接往Cookie中塞入中文信息。</p>
<p>举个例子，我要为我的博客投一个宣传广告：</p>
<ul>
<li>广告系列：Kevin博客宣传</li>
<li>广告来源：<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">google</a></li>
<li>广告媒介：PPC</li>
<li>带跟踪参数的着陆页面Url：<a href="http://www.imkevinyang.com/?utm_source=google&amp;utm_medium=ppc&amp;utm_campaign=Kevin%E5%8D%9A%E5%AE%A2%E5%AE%A3%E4%BC%A0">http://www.imkevinyang.com/?utm_source=google&amp;utm_medium=ppc&amp;utm_campaign=Kevin%E5%8D%9A%E5%AE%A2%E5%AE%A3%E4%BC%A0</a></li>
</ul>
<p>那么GA在写Cookie的时候，会执行类似下面的代码（当然这里简化了__utmz的值）：</p>
<pre class="brush: js">var data = "Kevin博客宣传";
// GA错误的Cookie操作
document.cookie = "_utmz=" + data;
// 正确的Cookie存储操作
document.cookie = "_utmz=" + encodeURI(data);</pre>
<p>使用Javascript对Cookie进行存取，标准的操作应该是在存入的时候编一次码，取出的时候解一次码。这样保证存放在Cookie中的都是ASCII字符。早期JS使用escape/unescape进行编解码，现在通常使用encodeURI或者encodeURIComponent函数，这两个函数用的都是UTF-8编码。</p>
<h2>中文Cookie潜在的问题</h2>
<p>那么当我们直接将中文直接存到Cookie又会发生了什么事呢？IE和Firefox的行为有什么不一样的地方呢？我们在IE8和Firefox3.6下做几个实验。</p>
<h3>IE8对中文Cookie的处理</h3>
<p>实验步骤：</p>
<ul>
<li>打开IE8，清空所有Cookie和缓存，建立干净的测试环境。</li>
<li>访问<a href="http://www.imkevinyang.com/">http://www.imkevinyang.com/</a></li>
<li>地址栏执行javascript:alert(document.cookie="mycookie=缂栫爜编码;expires=Mon, 25 May 2020 10:31:49 GMT")，写入一个持久化cookie。</li>
</ul>
<p>这样就在我的博客上设置了一个2020年5月25号过期的cookie了。之所以要设置持久化cookie而不是会话Cookie，是因为IE会将持久化Cookie写入到硬盘上了，这样方便我们了解这个过程，而会话cookie我目前还不清楚他存储的位置。</p>
<p>细心的你会注意到，上面这个cookie的值很奇怪，有几个乱码。其实那段乱码是我把“编码”这两个汉字的UTF-8编码（6个字节）使用GB2312解码（每两个字节对应一个字符）后得到的字符。至于为什么要这样测试，一会我们就会知道了。</p>
<p>IE地址栏用的是ANSI编码，也就是说当你在地址栏输入中文的时候，IE会将中文字符以系统默认字符集进行编码。当你使用中文系统时，地址栏的“编码”字符，实际上最后会被编码为B1 E0 C2 EB四个字节，而在英文系统下，系统使用的是西方字符集作为默认字符集，没有中文字符，因此“编码”这两个字符会被替换成?，也就是3F。</p>
<p>IE在创建cookie文件，会自动选择最合适的编码。当我们写入“缂栫爜编码”（GB2312编码后得到二进制流E7 BC 96 E7 A0 81 B1 E0 C2 EB），由于最后四个字节无法用UTF-8解码，因此IE会将文件存储为GB2312。（如果你只测试“缂栫爜”的话，IE会将文件存储为UTF-8）。</p>
<p>好了，现在让我们来看看文件里头都是什么内容。</p>
<p>打开everything工具，搜索“www.imkevinyang txt”这样就会列出文件名包含www.imkevinyang和txt的所有文件。</p>
<p><img style="display: inline; border-width: 0px;" title="Everything快速搜索" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image13.png" border="0" alt="Everything快速搜索" width="158" height="84" /></p>
<p>打开这个文件，里头存放的就是IE持久化的cookie信息。</p>
<p><img style="display: inline; border-width: 0px;" title="IE存储持久化Cookie的文件" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image14.png" border="0" alt="IE存储持久化Cookie的文件" width="144" height="164" /> <img style="display: inline; border-width: 0px;" title="IE存储持久化Cookie的文件——二进制形式" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image15.png" border="0" alt="IE存储持久化Cookie的文件——二进制形式" width="406" height="105" /></p>
<p>这个时候，我们再在地址栏通过javascript:alert(document.cookie)我们会发现，IE显示的Cookie值和我们一开始设置的是一样的。</p>
<p>看完了本地的Cookie信息，我们接下来看看IE发送给服务器的Cookie又是什么。</p>
<p>我们用Fiddler来监视整个HTTP通讯过程（这里不用HTTP Watch是因为HTTP Watch会将HTTP消息解码后显示出来，没办法看到原始二进制数据，不方便分析）。</p>
<p>我们再向我的博客首页发起一次访问，在Fiddler中我们会看到：</p>
<p>（文本形式）</p>
<p><img style="display: inline; border-width: 0px;" title="Fiddler观察发送中文Cookie（文本形式）" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image16.png" border="0" alt="Fiddler观察发送中文Cookie（文本形式）" width="477" height="185" /></p>
<p>（二进制原始数据）</p>
<p><img style="display: inline; border-width: 0px;" title="Fiddler观察发送中文Cookie（二进制形式）" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image17.png" border="0" alt="Fiddler观察发送中文Cookie（二进制形式）" width="474" height="198" /></p>
<p>我们很惊奇的看到，IE发送的并不是我们设置的那些字符“缂栫爜编码”（二进制是E7 BC 96 E7 A0 81 B1 E0 C2 EB），而是“编码����”（现在知道我为什么要用“缂栫爜编码”做测试了把）。对应的二进制是E7 BC 96 E7 A0 81 EF BF BD EF BF BD EF BF BD EF BF BD。注意到，IE将原始信息的后面4个字节替换成了EF BF BD.</p>
<p>这是因为IE发送HTTP消息的时候会检测字节流是否是能够以UTF-8解码，如果不行，那么会将相应的异常字节替换成EF BF BD（也就是对应�字符）。这有点类似于我们之前提到的，英文系统对于缺失的字符会使用?号替代。</p>
<h3>Firefox对于中文Cookie的处理</h3>
<p>Firefox不像IE那样把Cookie直接存储为文件的形式，所以我们研究起来没那么方便。</p>
<p>不过我们还是按照上面同样的步骤来做实验，不过这次为了简单起见我们修改一下测试的Cookie值。</p>
<ul>
<li>打开Firefox，清空所有Cookie和缓存，建立干净的测试环境。</li>
<li>访问<a href="http://www.imkevinyang.com/">http://www.imkevinyang.com/</a></li>
<li>地址栏执行javascript:alert(document.cookie="mycookie=1编码1")</li>
</ul>
<ul>第一次Firefox弹出的对话框显示我们Cookie应该是设置成功了，返回“1编码1”字符串。</ul>
<p><img style="display: inline; border: 0px;" title="Firefox设置Cookie" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image18.png" border="0" alt="Firefox设置Cookie" width="297" height="138" /></p>
<p>但如果你再次通过Javascript:alert(document.cookie)你会发现，这次弹出的内容变了：</p>
<p><img style="display: inline; border: 0px;" title="Firefox显示乱码的Cookie" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image19.png" border="0" alt="Firefox显示乱码的Cookie" width="325" height="117" /></p>
<p>我们通过Web Developer Toolbar查看当前域下的Cookie，发现，目前的Cookie确实是像上面第二个对话框所示的，是带乱码的：</p>
<p><img style="display: inline; border: 0px;" title="Web Developer Bar看到的乱码的Cookie" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image20.png" border="0" alt="Web Developer Bar看到的乱码的Cookie" width="222" height="188" /></p>
<p>我们现在关心的问题是，这个乱码是怎么来的？</p>
<p>我们先把这串文字拷贝到Notepad++中（注意，需要将Notepad++调到UCS-2编码状态下）看一下对应的字节是什么。</p>
<p><img style="display: inline; border: 0px;" title="乱码cookie的二进制" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image21.png" border="0" alt="乱码cookie的二进制" width="239" height="41" /></p>
<p>31是字符“1”的ASCII码。而16和01是哪来的呢？</p>
<p>其实是Unicode Code Point。“编码”的Unicode码是“7F16 7801”。上面显示的16和01就是截断了Unicode码高位得到的。为了证实这个结论，我又测试了好几个中文cookie，均是如此。</p>
<p>也就是说，Firefox的地址栏使用的是Unicode码，也就是说当你输入“mycookie=1编码1”这样的字符串的时候，Firefox看到的是：</p>
<p>\u006d\u0079\u0063\u006f\u006f\u006b\u0069\u0065\u003d\u0031\u7f16\u7801\u0031</p>
<p>在存储中文Cookie的时候，他会将Unicode的高位截断，保留低位。然后写入Cookie存储。这也是为什么我们会看到“编码”这个Cookie变成了“16 01”。</p>
<p>Firefox向服务端发送HTTP请求时对于http消息的编码处理方式和IE的一样，也是判断字节流能够以UTF-8进行解码，这里就不再赘述了。有兴趣的朋友可以按照上面的方法去测试。</p>
<h2>为什么Firefox无法访问</h2>
<p>基于上面对IE和Firefox对中文Cookie的处理方式的了解，我们现在可以知道，对于中文Cookie，IE是用ANSI编码，也就是说Cookie中永远不会出现ASCII字符集中的不可打印字符（GB2312编码每个字节也都是从A0开始的），而Firefox采用Unicode码，却又对其进行了高位截断，导致Cookie有可能会出现ASCII字符集中的非打印字符。</p>
<p>IE和Firefox在构造HTTP消息的时候对于字节流序列编码问题的处理方式一样。无法使用UTF-8解码的字节流序列，将其替换成EF BF BD，这个我们在Fiddler中已经看到了。而对于ASCII字符集的非打印字符则不做任何处理，直接发送到服务器端。</p>
<p>所以用Firefox访问，服务端收到的HTTP Request有可能包含非打印字符，而IE访问的话，则不会出现这样的情况。</p>
<p>例如Firefox上设置了一个中文Cookie，“我”，Unicode码是62 11，被Firefox高位截断了，就剩下11了，对应着ASCII码表中的Device Control 1，也就是控制字符。那么当你带着这个Cookie向服务端发起请求的时候服务端有可能就会直接抛出Bad Request的异常，告诉客户端，你发过来的请求不符合HTTP规范。</p>
<p>所以实际上不只是Cookie不能出现这样的非打印字符，其他HTTP Header中也不能出现这样的非打印字符。我们可以直接使用WFetch来构造这样的“非法”请求：</p>
<p><img style="display: inline; border: 0px;" title="Wfetch发送异常请求" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image22.png" border="0" alt="Wfetch发送异常请求" width="177" height="183" /> <img style="display: inline; border: 0px;" title="UserAgent中包含非打印字符" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image23.png" border="0" alt="UserAgent中包含非打印字符" width="283" height="164" /></p>
<p>服务端一样会抛出400 Bad Request。</p>
<h2>IIS和Apache的不同处理方式</h2>
<p>当客户端发起的请求存在问题时，服务端的处理方式是取决于不同服务器的实现的。我们上面讨论的这个问题，实际上只会对IIS造成影响，对那些后台采用Apache或者LiteSpeed这类的服务器不会有影响。这说明IIS的容错性还是稍微差一点，不知道从安全的角度来考虑是好事还是坏事。</p>
<h2>总结回顾</h2>
<p>上面讲了那么多，你可能听着有点乱了。我们重新来整理一遍整个故事。</p>
<blockquote><p>广告代理商投了一个广告，着陆页面Url中添加了<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">google</a>的广告参数，其中带有中文信息，客户网站上部署了GA代码，GA读取到此中文信息之后直接扔到Cookie中而没有经过编码。Firefox内部将此中文的Unicode码高位截断保留低位存下来。当你再次刷新页面的时候，Firefox把这个截断的字符发给IIS服务器，而刚好这个截断之后的字符是一个非打印字符，IIS觉得自己无法处理，就抛出一个Bad Request，告诉客户端此请求非法，我无法处理。</p></blockquote>
<p>整个故事就这样。</p>
<p>怎么办呢？建议为了保险起见，如果客户网站服务器用的是IIS，那么你还是不要在Firefox上投放那些Url跟踪参数带中文（即使是UTF-8编码过）的广告了，否则可能浪费钱，因为用户来了，再点一次可能就无法访问了，而且以后可能都无法访问了（现在终于知道为什么我那同事当时用Firefox始终访问不了新东方了...）。(<span style="color: #ff0000;">update:2010-7-2</span>)或者你在投放广告的时候，Url参数中的广告系列、广告媒介以及广告来源这三个跟踪参数不要包含中文信息（即使是UTF-8编码过的），全部使用英文，这样也不会有问题。</p>
<p>希望整个分析过程对你有所帮助。</p>
<p style="text-align: right;">——<a title="当Google Analytics、Firefox和IIS走到了一起..." href="http://www.imkevinyang.com/2010/05/%e5%bd%93Google%20Analytics%e3%80%81Firefox%e5%92%8cIIS%e8%b5%b0%e5%88%b0%e4%ba%86%e4%b8%80%e8%b5%b7....html"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/bad-request" title="Bad Request" rel="tag">Bad Request</a>, <a href="http://www.imkevinyang.com/tags/cookie" title="Cookie" rel="tag">Cookie</a>, <a href="http://www.imkevinyang.com/tags/fiddler" title="Fiddler" rel="tag">Fiddler</a>, <a href="http://www.imkevinyang.com/tags/firefox" title="Firefox" rel="tag">Firefox</a>, <a href="http://www.imkevinyang.com/tags/google-analytics" title="Google Analytics" rel="tag">Google Analytics</a>, <a href="http://www.imkevinyang.com/tags/http" title="HTTP" rel="tag">HTTP</a>, <a href="http://www.imkevinyang.com/tags/ie" title="IE" rel="tag">IE</a>, <a href="http://www.imkevinyang.com/tags/iis" title="IIS" rel="tag">IIS</a>, <a href="http://www.imkevinyang.com/tags/wfetch" title="WFetch" rel="tag">WFetch</a>, <a href="http://www.imkevinyang.com/tags/%e4%b8%ad%e6%96%87" title="中文" rel="tag">中文</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a>, <a href="http://www.imkevinyang.com/tags/%e9%9d%9e%e6%b3%95%e8%af%b7%e6%b1%82" title="非法请求" rel="tag">非法请求</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html" title="64位系统下IIS7 ISAPI处理器加载失败 (2010/05/05)">64位系统下IIS7 ISAPI处理器加载失败</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/document-referrer%e4%b8%a2%e5%a4%b1%e7%9a%84%e5%87%a0%e4%b8%aa%e5%8e%9f%e5%9b%a0.html" title="Document.Referrer丢失的几个原因 (2010/01/18)">Document.Referrer丢失的几个原因</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/07/firefox%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%ae%e7%89%b9%e5%ae%9a%e7%bd%91%e7%ab%99.html" title="Firefox无法访问特定网站 (2009/07/02)">Firefox无法访问特定网站</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/01/google-analytics%e4%b8%ad%e7%9a%84page%e7%bb%b4%e5%ba%a6.html" title="Google Analytics中的Page维度 (2010/01/04)">Google Analytics中的Page维度</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/ie%e4%b8%ad%e4%bd%bf%e7%94%a8windowopen%e6%89%93%e5%bc%80%e6%96%b0%e7%aa%97%e5%8f%a3%e6%97%b6%e6%97%a0%e6%b3%95%e8%8e%b7%e5%8f%96referrer%e5%af%b9%e8%b1%a1.html" title="IE中使用window.open打开新窗口时无法获取Referrer对象 (2009/03/07)">IE中使用window.open打开新窗口时无法获取Referrer对象</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/09/ie%e6%97%a0%e6%b3%95%e8%ae%be%e7%bd%ae%e7%9f%ad%e5%9f%9f%e5%90%8d%e4%b8%8bcookie.html" title="IE无法设置短域名下Cookie (2010/09/06)">IE无法设置短域名下Cookie</a> </li>
	<li><a href="http://www.imkevinyang.com/2011/06/iis%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%ad%90%e7%9b%ae%e5%bd%95%e6%96%87%e4%bb%b6%e4%bd%9c%e4%b8%ba%e9%bb%98%e8%ae%a4%e6%96%87%e6%a1%a3%ef%bc%88default-document%ef%bc%89%e6%9b%bf%e4%bb%a3%e9%87%8d%e5%ae%9a.html" title="IIS中使用子目录文件作为默认文档（Default Document）替代重定向 (2011/06/15)">IIS中使用子目录文件作为默认文档（Default Document）替代重定向</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/06/javascript%e6%93%8d%e7%ba%b5cookie.html" title="Javascript操纵Cookie (2009/06/11)">Javascript操纵Cookie</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/02/silverlight%e5%90%af%e7%94%a8assembly-caching%e4%b9%8b%e5%90%8e%e9%93%81%e9%80%9a%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%ae.html" title="Silverlight启用Assembly Caching之后铁通用户无法访问 (2010/02/13)">Silverlight启用Assembly Caching之后铁通用户无法访问</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/%e3%80%90%e6%8e%a8%e8%8d%90%e3%80%91%e4%b8%a4%e6%ac%behttp%e6%b5%81%e9%87%8f%e5%88%86%e6%9e%90%e5%b7%a5%e5%85%b7%e7%9a%84%e6%af%94%e8%be%83.html" title="【推荐】两款HTTP流量分析工具的比较 (2009/11/08)">【推荐】两款HTTP流量分析工具的比较</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/05/%e5%bd%93google-analytics%e3%80%81firefox%e5%92%8ciis%e8%b5%b0%e5%88%b0%e4%ba%86%e4%b8%80%e8%b5%b7.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>SSIS调用存储过程失败</title>
		<link>http://www.imkevinyang.com/2010/05/ssis%e8%b0%83%e7%94%a8%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%a4%b1%e8%b4%a5.html</link>
		<comments>http://www.imkevinyang.com/2010/05/ssis%e8%b0%83%e7%94%a8%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%a4%b1%e8%b4%a5.html#comments</comments>
		<pubDate>Sun, 23 May 2010 07:02:47 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[charindex]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSIS]]></category>
		<category><![CDATA[substring]]></category>
		<category><![CDATA[存储过程]]></category>
		<category><![CDATA[校验失败]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2010/05/ssis%e8%b0%83%e7%94%a8%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%a4%b1%e8%b4%a5.html</guid>
		<description><![CDATA[<p>最近更新了一个Sql存储过程的实现，结果导致做ETL的SSIS（Sql Server Integration Services）包出现了问题。在调试状态下发现，SSIS在启动时对包做校验的过程中抛出了异常，显示我修改后的这个存储过程有问题。</p>
<p> </p>
<blockquote><p>Invalid length parameter passed to the&#8230;</p></blockquote>]]></description>
			<content:encoded><![CDATA[<p>最近更新了一个Sql存储过程的实现，结果导致做ETL的SSIS（Sql Server Integration Services）包出现了问题。在调试状态下发现，SSIS在启动时对包做校验的过程中抛出了异常，显示我修改后的这个存储过程有问题。</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image10.png" width="558" height="66" /> </p>
<blockquote><p>Invalid length parameter passed to the substring or left function.</p>
</blockquote>
<p>奇怪的是，这还不是调用的时候抛出了异常，而是在校验阶段（Validation Stage）就抛出了异常。我感到纳闷，难道SSIS或者Sql Server还能对我的存储过程作单元测试？？</p>
<p>用这句错误信息上<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a>搜了一下，发现问题是出在CharIndex函数和Substring函数的联合调用上。为了简化，我下面只摘取了一段出问题的代码：</p>
<pre class="brush: sql">declare @index int
set @index = charindex('/',@url,1)
set @url = substring(@url,1,@index - 1)</pre>
</p>
<p>以前的VBA函数还有Sql函数都喜欢使用1作为数组起始索引，用0表示返回失败，而不像现在C风格下使用0作为起始索引，-1作为失败返回值。charindex这个sql函数是用来查找某个字符串在特定字符串中的位置，如果找不着匹配的，则返回0。而下一行代码中的substring又传入了一个@index-1的参数，因此此参数有可能为负数。猜测就是因为这样，所以SSIS检测失败，抛出异常。之所以当时这么写，是因为基于一个假设，就是业务系统中，此字段都会包含/字符。但是人家SSIS组件可不认你的假设。（再一次证明了，编程的时候假设越少越好）</p>
<p>既然如此，我们就多加一层检测。修改代码如下：</p>
<pre class="brush: sql">declare @index int
set @index = charindex('/',@url,1)
if(@index &gt; 0)
  set @url = substring(@url,1,@index - 1)</pre>
<p>启动SSIS包，结果还是抛出一样的错误。这就奇怪了。难道做了检测还不行？难道substring的第三个参数非得是大于0的？试了一下，改成if(@index &gt; 1000)都不行。</p>
<p>想了半天，最终我只能怀疑，SSIS的这个校验组件，是通过判断变量什么时候被赋值来获得值的可能范围是多少，而不会判断上下文是否有对变量做有效性检测。也就是说，在上面这个存储过程中，@index变量只在charindex函数返回时被赋值，值范围是0~正无穷。因此传给substring的第三个参数的时候，@index – 1的值范围就变成了-1~正无穷了。它直接无视我上面的if语句了。</p>
<p>把这个猜想和同事讨论了一下，他设计了一个验证方案，就是添加一行永远不会被执行的的赋值语句。代码如下：</p>
<pre class="brush: sql">declare @index int
set @index = charindex('/',@url,1)
if(@index &gt; 0)
begin
  if(1=0) set @index = 1000
  set @url = substring(@url,1,@index - 1)
end</pre>
<p>注意上面代码中将@index赋值为1000的操作，是不会被执行的。可是却通过了SSIS的校验。这说明，SSIS的校验组件做的工作实际上是非常简单的校验而已，不会参考上下文代码。</p>
<p>既然如此，这个校验对于开发人员来说，不但没有意义，而且还会影响我们编写逻辑正确的代码。因为这个校验是不能被关闭的。也就是说，为了绕过这个没意义而且错误的校验，我不得不在charindex和substring这种联合调用的代码中加入一行永远不会被执行的赋值语句来迷惑SSIS的校验组件。否则SSIS的包根本启动不了。</p>
<p>感觉这应该是一个设计上的Bug。</p>
<p>希望对遇到这个问题的人有所帮助。</p>
<p style="text-align: right">——<a title="SSIS调用存储过程失败" href="http://www.imkevinyang.com/2010/05/SSIS%e8%b0%83%e7%94%a8%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%a4%b1%e8%b4%a5.html"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/charindex" title="charindex" rel="tag">charindex</a>, <a href="http://www.imkevinyang.com/tags/sql" title="SQL" rel="tag">SQL</a>, <a href="http://www.imkevinyang.com/tags/sql-server" title="SQL Server" rel="tag">SQL Server</a>, <a href="http://www.imkevinyang.com/tags/ssis" title="SSIS" rel="tag">SSIS</a>, <a href="http://www.imkevinyang.com/tags/substring" title="substring" rel="tag">substring</a>, <a href="http://www.imkevinyang.com/tags/%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b" title="存储过程" rel="tag">存储过程</a>, <a href="http://www.imkevinyang.com/tags/%e6%a0%a1%e9%aa%8c%e5%a4%b1%e8%b4%a5" title="校验失败" rel="tag">校验失败</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2009/05/sql-server%e4%b8%ad%e4%bf%ae%e6%94%b9%e8%87%aa%e5%a2%9e%e9%95%bf%e5%88%97%e7%bb%8f%e5%b8%b8%e9%9c%80%e8%a6%81%e7%94%a8%e5%88%b0%e7%9a%84%e9%85%8d%e7%bd%ae.html" title="Sql Server中修改自增长列经常需要用到的配置 (2009/05/24)">Sql Server中修改自增长列经常需要用到的配置</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/08/sql-server%e9%87%8d%e5%91%bd%e5%90%8d%e6%89%80%e6%9c%89%e5%a4%96%e9%94%ae%e7%ba%a6%e6%9d%9f.html" title="Sql Server重命名所有外键约束 (2010/08/02)">Sql Server重命名所有外键约束</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/07/sql-tipsupdate%e8%af%ad%e5%8f%a5%e4%b9%9f%e4%bd%bf%e7%94%a8%e8%a1%a8%e5%88%ab%e5%90%8dtable-alias.html" title="Sql Tips——Update语句也使用表别名(Table Alias) (2010/07/02)">Sql Tips——Update语句也使用表别名(Table Alias)</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/10/%e5%85%a8%e5%8d%8a%e8%a7%92%e7%a9%ba%e6%a0%bc%e5%af%bc%e8%87%b4%e7%9a%84analysis-service%e5%a4%84%e7%90%86%e9%94%99%e8%af%af.html" title="全半角空格导致的Analysis Services处理错误 (2009/10/09)">全半角空格导致的Analysis Services处理错误</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/09/%e9%87%8a%e6%94%besql-server%e5%8d%a0%e7%94%a8%e7%9a%84%e5%86%85%e5%ad%98.html" title="释放SQL Server占用的内存 (2009/09/01)">释放SQL Server占用的内存</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/05/ssis%e8%b0%83%e7%94%a8%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%a4%b1%e8%b4%a5.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>为什么IIS7/7.5的Gzip不起作用</title>
		<link>http://www.imkevinyang.com/2010/05/%e4%b8%ba%e4%bb%80%e4%b9%88iis77-5%e7%9a%84gzip%e4%b8%8d%e8%b5%b7%e4%bd%9c%e7%94%a8.html</link>
		<comments>http://www.imkevinyang.com/2010/05/%e4%b8%ba%e4%bb%80%e4%b9%88iis77-5%e7%9a%84gzip%e4%b8%8d%e8%b5%b7%e4%bd%9c%e7%94%a8.html#comments</comments>
		<pubDate>Sat, 08 May 2010 09:56:35 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[GZip压缩]]></category>
		<category><![CDATA[IIS6]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[IIS7.5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[动态压缩]]></category>
		<category><![CDATA[静态压缩]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/?p=1418</guid>
		<description><![CDATA[<p>我在<a title="IIS7配置Gzip压缩" href="http://www.imkevinyang.com/2009/06/iis7%E9%85%8D%E7%BD%AEgzip%E5%8E%8B%E7%BC%A9.html" target="_blank">IIS7配置Gzip压缩</a>一文中介绍了IIS7对于gzip压缩的相关配置，以及默认情况下，由于IIS7将Javascript配置为动态压缩（Dynamic Compression），受CPU还有其他因素的影响，不一定会返回gzip压缩后的内容。 但是前阵子发现，尽管将Javascript配置成了静态压&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>我在<a title="IIS7配置Gzip压缩" href="http://www.imkevinyang.com/2009/06/iis7%E9%85%8D%E7%BD%AEgzip%E5%8E%8B%E7%BC%A9.html" target="_blank">IIS7配置Gzip压缩</a>一文中介绍了IIS7对于gzip压缩的相关配置，以及默认情况下，由于IIS7将Javascript配置为动态压缩（Dynamic Compression），受CPU还有其他因素的影响，不一定会返回gzip压缩后的内容。 但是前阵子发现，尽管将Javascript配置成了静态压缩，请求Javascript脚本文件的时候偶尔还是会出现没有gzip的情况。这篇文章和大家分享一下我遇到的这个问题以及解决这个问题的过程和思路，希望对大家有所帮助。</p>
<h2>“随机”的gzip行为</h2>
<p>问题的症状非常简单而又奇怪。有时候连续访问脚本多次，刚开始没有gzip，再次访问又有gzip。等过好一会再去访问，gzip又没有了。有的时候则是无论怎么访问都不给我返回gzip后的响应。</p>
<h2>问题的分析</h2>
<p>排除了CPU负载过大的因素，因为发现当深夜机器CPU负载正常的时候也一样出现这样的问题。</p>
<p>在系统日志中发现以下Warning条目，引起了我的注意：</p>
<blockquote><p>Warning    2010/4/13 6:32:41    IIS-W3SVC-WP    2264    None</p>
<p>The directory specified for caching compressed content C:\inetpub\temp\IIS Temporary Compressed Files\XXX is invalid.  Static compression is being disabled.</p></blockquote>
<p>通过日志筛选，发现从09年7月份就一直出现这样的Warning了，而且出现频率是隔1-3天左右。</p>
<p>这个文件夹是IIS用于存放压缩后的静态内容缓存。按照上面日志的意思，是说这个目录出了问题，导致静态压缩功能被禁用了。但是我明明可以访问这个文件夹，而且里头确实还放着缓存的脚本。</p>
<p>IIS论坛上提这个问题的帖子很多，但最终得到解答的没看到。不过其中一些人的回复倒是给了我不少思路。其中有人说道可能是文件夹权限问题，我看了看那个压缩缓存目录，上面的权限的确是应用程序池的身份，没有问题。使用ProcessMonitor监测了w3wp.exe进程的活动情况，没有看到这个进程在访问文件系统时出现错误。</p>
<p>后来在网上看到了<a href="http://www.ksingla.net/">Kanwaljeet Singla</a>（IIS开发团队成员）的一篇文章，介绍IIS7相比IIS6在压缩模块上的改动，文中提到了一点，<strong><span style="color: #008000;">从IIS7开始，为了降低开销，IIS只对那些频繁访问的静态资源启用压缩</span></strong>。通过IIS7新引入的两个配置选项frequentHitThreshold和frequentHitTimePeriod，我们可以设定，当某个资源在frequentHitTimePeriod时间内被连续访问了frequentHitThreshold次，那么就算是“频繁访问”了。默认的配置是10秒钟内连续对同一Url发起2次请求就算此Url对应的资源属于频繁访问的资源，IIS服务器就会对其进行压缩，然后丢入缓存目录。</p>
<p>这也就解释了为什么有时候第一次请求脚本的时候，服务器没有返回gzip压缩后的内容，而是等你接着下一次访问的时候才会返回gzip响应。</p>
<p><img style="display: inline; border-width: 0px;" title="连续访问Javascript才会gzip" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image2.png" border="0" alt="连续访问Javascript才会gzip" width="494" height="85" /></p>
<p>但是按照这篇文章提到的IIS的设计理念，一旦资源被压缩缓存过，那么以后就不会再应用这个“频繁访问”的检测逻辑了，因为毕竟已经没有压缩开销了。而我非常确信这个脚本已经被缓存在服务器硬盘上了，那为什么我过一段时间再去访问的时候还是没有gzip呢？</p>
<p>在IIS7中有一个功能，叫做失败请求跟踪（Failed request tracing），允许技术人员跟踪那些出问题的请求在IIS内部都发生了什么事。为了揭开我的疑问，我对此网站开启了失败请求跟踪。</p>
<h2>IIS7的Bug？！</h2>
<p>打开IIS7管理器，定位到相应的网站右侧的操作面板，开启“失败请求跟踪”。默认跟踪日志文件是存放在%SystemDrive%\inetpub\logs\FailedReqLogFiles目录中。</p>
<p><img style="display: inline; border-width: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image3.png" border="0" alt="image" width="138" height="93" /> <img style="display: inline; border-width: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image4.png" border="0" alt="image" width="192" height="120" /></p>
<p>然后在功能面板中找到“失败请求跟踪规则”进行配置：</p>
<p><img style="display: inline; border-width: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image5.png" border="0" alt="image" width="202" height="128" /></p>
<p>为了防止其他脚本的干扰，在这里我限定了只跟踪测试的脚本</p>
<p><img style="display: inline; border-width: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image6.png" border="0" alt="image" width="164" height="159" /></p>
<p>响应状态填写200即可</p>
<p><img style="display: inline; border-width: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image7.png" border="0" alt="image" width="146" height="151" /></p>
<p>接下来是选择跟踪提供程序，也就是给你提供跟踪日志源的程序，由于我们的脚本只经过静态文件处理器，因此这里我们只需要选择www server处理程序即可。</p>
<p><img style="display: inline; border-width: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image8.png" border="0" alt="image" width="274" height="245" /></p>
<p>然后我们就可以去测试一下访问出问题的脚本了。一旦IIS中途处理遇到些问题，那么就会以xml形式记录下相关的日志。打开FailedReqLogFiles目录，里头会有一些fr000001.xml这样格式的文件，每个文件代表一次失败请求。我们打开这个文件，查找compression关键词，发现了以下内容：</p>
<pre class="brush: xml;">&lt;Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"&gt;
 &lt;System&gt;
  &lt;Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/&gt;
  &lt;EventID&gt;0&lt;/EventID&gt;
  &lt;Version&gt;1&lt;/Version&gt;
  &lt;Level&gt;4&lt;/Level&gt;
  &lt;Opcode&gt;3&lt;/Opcode&gt;
  &lt;Keywords&gt;0x40&lt;/Keywords&gt;
  &lt;TimeCreated SystemTime="2010-05-13T16:59:08.086Z"/&gt;
  &lt;Correlation ActivityID="{00000000-0000-0000-FD2B-008041000061}"/&gt;
  &lt;Execution ProcessID="10752" ThreadID="14504"/&gt;
  &lt;Computer&gt;DMZ&lt;/Computer&gt;
 &lt;/System&gt;
 &lt;EventData&gt;
  &lt;Data Name="ContextId"&gt;{00000000-0000-0000-FD2B-008041000061}&lt;/Data&gt;
  &lt;Data Name="Reason"&gt;14&lt;/Data&gt;
 &lt;/EventData&gt;
 &lt;RenderingInfo Culture="zh-CN"&gt;
  &lt;Opcode&gt;STATIC_COMPRESSION_NOT_SUCCESS&lt;/Opcode&gt;
  &lt;Keywords&gt;
   &lt;Keyword&gt;Compression&lt;/Keyword&gt;
  &lt;/Keywords&gt;
  &lt;freb:Description Data="Reason"&gt;NOT_FREQUENTLY_HIT&lt;/freb:Description&gt;
 &lt;/RenderingInfo&gt;
 &lt;ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace"&gt;
  &lt;EventGuid&gt;{E60CEE96-4472-448D-A13C-2170B18220EC}&lt;/EventGuid&gt;
 &lt;/ExtendedTracingInfo&gt;
&lt;/Event&gt;</pre>
<p>在上面，我们看到了NOT_FREQUENTLY_HIT的字样，看上去响应没有gzip的原因，还是因为没有达到“频繁访问”的要求，即使请求的资源已经被压缩过然后存放在硬盘上了。似乎这个压缩缓存是有一定的时效的，就是过了多长时间就得重新验证一下这个“频繁访问”的逻辑了。</p>
<p>我又进行了大量的测试，发现这个失效时间大约是在5分钟。也就是说，当你频繁访问一个资源，IIS开始对其进行压缩并存放在本地压缩缓存目录之后，大约过5分钟，你再去访问，还是会重新执行“频繁访问”这个验证逻辑。</p>
<p>为了证实我得到的结论，我在推特上向<a href="http://www.ksingla.net/">Kanwaljeet Singla</a>（他的推特是@kjsingla）询问了这个问题。出乎我的意料，他很快就回复了我，估计是因为我在做这个测试的时候已经半夜了，他那边刚好是白天的缘故吧。他经过测试，证实“频繁访问”的逻辑检测发生在“响应是否已经压缩”逻辑之前，这确实是IIS7/7.5的一个Bug。</p>
<p>解决办法倒是很简单，只需要将“频繁访问”定义得更宽泛一些即可。例如1分钟内1次访问。</p>
<pre class="brush: xml">&lt;configuration&gt;
    &lt;system.webServer&gt;
        &lt;serverRuntime frequentHitThreshold="1" frequentHitTimePeriod="00:01:00" /&gt;
    &lt;/system.webServer&gt;
&lt;/configuration&gt;</pre>
<h2>问题真的解决了吗？</h2>
<p>当我以为问题圆满解决，满意的睡着之后，第二天测试的时候发现请求脚本又没有gzip了，而且这次是连着访问好几次都没有压缩，这没法用我昨晚得到的结论去解释。让我非常郁闷-_-|||</p>
<p>冷静！</p>
<p>在系统日志中，我又看到了压缩目录无效的警告信息了，但这次，这个压缩目录是真没了。回想起那个时刻做的操作，当时运营的网站抛出未处理的异常，我修改完这个异常就把应用程序池给重启了。难道是说，当网站出现异常的时候，如果强制回收应用程序池的话，会导致静态压缩目录被删除？更奇怪的是，当我再次回收应用程序池，发现这个压缩目录又被重新创建了。</p>
<p>为了验证我的猜想，我又重复了这个过程，让网站抛出异常=&gt;重启应用程序池=&gt;再次请求脚本，问题重现；我又新建了一个一摸一样配置的测试网站，同样的测试流程，却发现压缩目录正常，没有出现上述的症状。</p>
<p>经过细致的对比，我发现运营的网站和我测试的网站环境还是不大一样的。运营的网站时时刻刻都有外部的请求，而且还很频繁。而测试网站不会有任何干扰的流量。</p>
<p>为了模拟真实的情况，我用iMacro写了一个宏，不间断的向测试网站请求该脚本。一开始，可以看到压缩目录确实是存在的，然后我在中途手动回收了应用程序池。发现压缩缓存目录确实被删除了。</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image9.png" border="0" alt="image" width="449" height="115" /></p>
<p>经过再细致的测试，我最终得到一个结论：</p>
<blockquote><p>在IIS7/7.5中，如果为应用程序池配置了administrator的账号权限，那么如果在应用程序池处理静态文件压缩的时候回收应用程序池，会导致压缩缓存目录被删除。直到下次应用程序池健康重启的时候，此压缩缓存目录才会被重新创建。</p></blockquote>
<p>这个结论我还没有得到IIS团队的证实。但在我几台机器上的IIS7和7.5测试的结果确实都是这样的。联想之前的系统日志中，每隔1-3天就出现这样的问题，刚好是因为IIS7默认的回收间隔是1740分钟，也就是1天5小时。我计算了一下系统日志中的所有关于静态压缩目录警告出现的时间，和这个回收间隔的倍数非常吻合。</p>
<p>解决办法有两个：</p>
<ul>
<li>如果没有必要，则不要给应用程序池配置administrator的账号，使用内置的账号不会出现这样的问题。</li>
<li>禁用固定时间间隔回收，改成在一个相对空闲的固定时刻回收，例如半夜4点。</li>
</ul>
<ul>希望我奋战2个晚上得到的结论对你有所帮助~</ul>
<p style="text-align: right;">——<a title="为什么IIS7/7.5的Gzip不起作用" href="http://www.imkevinyang.com/2010/05/%E4%B8%BA%E4%BB%80%E4%B9%88iis77-5%E7%9A%84gzip%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.html" target="_self"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/gzip%e5%8e%8b%e7%bc%a9" title="GZip压缩" rel="tag">GZip压缩</a>, <a href="http://www.imkevinyang.com/tags/iis6" title="IIS6" rel="tag">IIS6</a>, <a href="http://www.imkevinyang.com/tags/iis7" title="IIS7" rel="tag">IIS7</a>, <a href="http://www.imkevinyang.com/tags/iis7-5" title="IIS7.5" rel="tag">IIS7.5</a>, <a href="http://www.imkevinyang.com/tags/javascript" title="Javascript" rel="tag">Javascript</a>, <a href="http://www.imkevinyang.com/tags/%e5%8a%a8%e6%80%81%e5%8e%8b%e7%bc%a9" title="动态压缩" rel="tag">动态压缩</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a>, <a href="http://www.imkevinyang.com/tags/%e9%9d%99%e6%80%81%e5%8e%8b%e7%bc%a9" title="静态压缩" rel="tag">静态压缩</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html" title="64位系统下IIS7 ISAPI处理器加载失败 (2010/05/05)">64位系统下IIS7 ISAPI处理器加载失败</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/button%e6%a0%87%e7%ad%be%e9%bc%a0%e6%a0%87%e7%82%b9%e5%87%bb%e4%ba%8b%e4%bb%b6%e7%9a%84%e8%a7%a6%e5%8f%91%e6%ba%90%e9%97%ae%e9%a2%98.html" title="Button标签鼠标点击事件的触发源问题 (2009/11/27)">Button标签鼠标点击事件的触发源问题</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/ie%e4%b8%ad%e4%bd%bf%e7%94%a8windowopen%e6%89%93%e5%bc%80%e6%96%b0%e7%aa%97%e5%8f%a3%e6%97%b6%e6%97%a0%e6%b3%95%e8%8e%b7%e5%8f%96referrer%e5%af%b9%e8%b1%a1.html" title="IE中使用window.open打开新窗口时无法获取Referrer对象 (2009/03/07)">IE中使用window.open打开新窗口时无法获取Referrer对象</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/06/iis7%e9%85%8d%e7%bd%aegzip%e5%8e%8b%e7%bc%a9.html" title="IIS7配置Gzip压缩 (2009/06/29)">IIS7配置Gzip压缩</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/07/javajs%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%8c%b9%e9%85%8d%e5%b5%8c%e5%a5%97html%e6%a0%87%e7%ad%be.html" title="Java/Js如何使用正则表达式匹配嵌套Html标签 (2010/07/30)">Java/Js如何使用正则表达式匹配嵌套Html标签</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/07/javascript-%e4%b8%ad%e7%9a%84false%e9%9b%b6%e5%80%bcnullundefined%e5%92%8c%e7%a9%ba%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%af%b9%e8%b1%a1.html" title="Javascript 中的false,零值,null,undefined和空字符串对象 (2009/07/07)">Javascript 中的false,零值,null,undefined和空字符串对象</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/05/javascript%e4%b8%ad%e8%8e%b7%e5%8f%96%e5%87%ba%e9%94%99%e4%bb%a3%e7%a0%81%e6%89%80%e5%9c%a8%e6%96%87%e4%bb%b6%e5%8f%8a%e8%a1%8c%e6%95%b0.html" title="Javascript中获取出错代码所在文件及行数 (2009/05/18)">Javascript中获取出错代码所在文件及行数</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/04/javascript%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%93%88%e5%b8%8c%e5%87%bd%e6%95%b0.html" title="Javascript字符串哈希函数 (2009/04/11)">Javascript字符串哈希函数</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/06/javascript%e6%93%8d%e7%ba%b5cookie.html" title="Javascript操纵Cookie (2009/06/11)">Javascript操纵Cookie</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/09/%e4%bd%bf%e7%94%a8%e7%9b%b8%e5%af%b9url%e6%97%a0%e7%bc%9d%e5%88%87%e6%8d%a2http-https.html" title="使用相对Url无缝切换HTTP-HTTPS (2009/09/18)">使用相对Url无缝切换HTTP-HTTPS</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/05/%e4%b8%ba%e4%bb%80%e4%b9%88iis77-5%e7%9a%84gzip%e4%b8%8d%e8%b5%b7%e4%bd%9c%e7%94%a8.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>64位系统下IIS7 ISAPI处理器加载失败</title>
		<link>http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html</link>
		<comments>http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html#comments</comments>
		<pubDate>Tue, 04 May 2010 16:01:18 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[ISAPI]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html</guid>
		<description><![CDATA[症状
<p>公司一台数据库服务器上部署了IIS网站（IIS7），利用Sql Server Analysis Services的msmdpump.dll组件，实现了通过HTTP层来访问Analysis Services（MSAS不支持HTTP远程访问，非HTTP的远程访问也一直没成功过）。运行状况一直良好，最近突然罢&#8230;</p>]]></description>
			<content:encoded><![CDATA[<h2>症状</h2>
<p>公司一台数据库服务器上部署了IIS网站（IIS7），利用Sql Server Analysis Services的msmdpump.dll组件，实现了通过HTTP层来访问Analysis Services（MSAS不支持HTTP远程访问，非HTTP的远程访问也一直没成功过）。运行状况一直良好，最近突然罢工。Debug发现在建立连接的时候总是抛出“The Connection either timed out or was lost”。</p>
<h2>诊断</h2>
<p>尝试用企业管理器直接连接Analysis Services，成功，数据访问也正常，说明Analysis Services服务运作正常。那看来问题是出在了IIS这一层。</p>
<p>直接在浏览器中通过http://machinename/olap/msmdpump.dll去访问的时候，会弹出一个保存文件的对话框。正常情况下，服务器会返回500，因为没有数据输入。现在弹出保存文件的对话框，说明IIS把这个dll资源当作一个普通文件来对待了，而不是调用ISAPI处理器来处理。</p>
<p>细看了网站的配置，似乎没有问题，重新部署了一个网站，重新配置了ISAPI处理器映射，问题依旧出现。</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ISAPI处理器映射" border="0" alt="ISAPI处理器映射" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image.png" width="211" height="175" /></p>
<p>自己探索了很久，未果，<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a>了很久，一篇文章（IIS7 - Running 32-bit and 64-bit ASP.NET versions at the same time on different worker processes）提醒了我。这篇文章讲的是如何在不同的应用程序池进程上同时使用32位和64位的Asp.Net。</p>
<p>公司服务器出于性能考虑，用了64位系统。相应的msmdpump.dll文件也是64位的，但IIS的应用程序池进程是多少位的，我倒还真没考虑过。任务管理器一看，只有一个&quot;w3wp.exe * 32”，果然是32位的。那问题的原因应该是，<strong><span style="color: #008000">32位的应用程序池无法加载64位的Isapi处理器</span></strong>。</p>
<p>知道了问题所在，解决方法也很简单，启动一个64位的应用程序池就行了。打开应用程序池的高级设置，找到了“启用32位应用程序（enable32bitAppOnWin64）”的设置，将其从原来的True改成False（默认值为False）。这个选项的作用就是允许在64位操作系统上，以32位的应用程序池去加载32位的程序。</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="enable32bitAppOnWin64" border="0" alt="enable32bitAppOnWin64" src="http://www.imkevinyang.com/wp-content/uploads/2010/05/image1.png" width="358" height="33" /></p>
<p>之所以会突然出现这个问题，是因为IIS的机器配置文件ApplicationHost.config文件中，全局应用程序池的enable32bitAppOnWin64默认值被意外修改为True。而我部署的IIS网站，由于没有显式设置此选项，因此会继承ApplicationHost.config文件中的默认值。</p>
<h2>举一反三</h2>
<p>64位系统下经常会出现一些莫名其妙的问题。因为64位系统允许运行32位应用程序，但是32位程序却无法加载64位程序集。所以如果你发现你的32位程序无法正常启动，查一查是否因为目标程序集是64位的缘故。例如最近安装了微软的StreamInsight，发现是32位的，但是本地的Sql Compact Framework是64位，结果启动的时候抛出了个DllNotFoundException。</p>
<p style="text-align: right">——<a title="64位系统下IIS7 ISAPI处理器加载失败" href="http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8bIIS7%20ISAPI%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/analysis-services" title="Analysis Services" rel="tag">Analysis Services</a>, <a href="http://www.imkevinyang.com/tags/http" title="HTTP" rel="tag">HTTP</a>, <a href="http://www.imkevinyang.com/tags/iis" title="IIS" rel="tag">IIS</a>, <a href="http://www.imkevinyang.com/tags/iis7" title="IIS7" rel="tag">IIS7</a>, <a href="http://www.imkevinyang.com/tags/isapi" title="ISAPI" rel="tag">ISAPI</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2009/04/analysis-services-2005-olap%e8%ae%be%e8%ae%a1%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5.html" title="Analysis Services 2005 OLAP设计最佳实践 (2009/04/02)">Analysis Services 2005 OLAP设计最佳实践</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/04/analysis-services%ef%bc%9a%e4%bd%a0%e5%ba%94%e8%af%a5%e4%bd%bf%e7%94%a8%e5%a4%9a%e5%af%b9%e5%a4%9a%e7%bb%b4%e5%ba%a6%e5%90%97%ef%bc%9f.html" title="Analysis Services：你应该使用多对多维度吗？ (2010/04/12)">Analysis Services：你应该使用多对多维度吗？</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/bids%e9%83%a8%e7%bd%b2%e6%97%b6%e5%87%ba%e7%8e%b0%e5%85%83%e6%95%b0%e6%8d%ae%e7%ae%a1%e7%90%86%e5%99%a8%e5%8f%91%e7%94%9f%e9%94%99%e8%af%af.html" title="BIDS部署时出现元数据管理器发生错误 (2009/03/13)">BIDS部署时出现元数据管理器发生错误</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/06/iis7%e9%85%8d%e7%bd%aegzip%e5%8e%8b%e7%bc%a9.html" title="IIS7配置Gzip压缩 (2009/06/29)">IIS7配置Gzip压缩</a> </li>
	<li><a href="http://www.imkevinyang.com/2011/06/iis%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%ad%90%e7%9b%ae%e5%bd%95%e6%96%87%e4%bb%b6%e4%bd%9c%e4%b8%ba%e9%bb%98%e8%ae%a4%e6%96%87%e6%a1%a3%ef%bc%88default-document%ef%bc%89%e6%9b%bf%e4%bb%a3%e9%87%8d%e5%ae%9a.html" title="IIS中使用子目录文件作为默认文档（Default Document）替代重定向 (2011/06/15)">IIS中使用子目录文件作为默认文档（Default Document）替代重定向</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/08/olap%e4%b8%ad%e7%9a%84averageofchildren%e8%81%9a%e5%90%88%e6%96%b9%e5%bc%8f.html" title="OLAP中的AverageOfChildren聚合方式 (2009/08/10)">OLAP中的AverageOfChildren聚合方式</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/02/silverlight%e5%90%af%e7%94%a8assembly-caching%e4%b9%8b%e5%90%8e%e9%93%81%e9%80%9a%e7%94%a8%e6%88%b7%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%ae.html" title="Silverlight启用Assembly Caching之后铁通用户无法访问 (2010/02/13)">Silverlight启用Assembly Caching之后铁通用户无法访问</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/07/ssas%e5%a4%84%e7%90%86%e6%97%b6%e6%89%be%e4%b8%8d%e5%88%b0%e5%b1%9e%e6%80%a7%e9%94%ae%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95.html" title="SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法 (2010/07/19)">SSAS处理时&ldquo;找不到属性键&rdquo;的解决办法</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/%e3%80%90%e6%8e%a8%e8%8d%90%e3%80%91%e4%b8%a4%e6%ac%behttp%e6%b5%81%e9%87%8f%e5%88%86%e6%9e%90%e5%b7%a5%e5%85%b7%e7%9a%84%e6%af%94%e8%be%83.html" title="【推荐】两款HTTP流量分析工具的比较 (2009/11/08)">【推荐】两款HTTP流量分析工具的比较</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/05/%e4%b8%ba%e4%bb%80%e4%b9%88iis77-5%e7%9a%84gzip%e4%b8%8d%e8%b5%b7%e4%bd%9c%e7%94%a8.html" title="为什么IIS7/7.5的Gzip不起作用 (2010/05/08)">为什么IIS7/7.5的Gzip不起作用</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/05/64%e4%bd%8d%e7%b3%bb%e7%bb%9f%e4%b8%8biis7-isapi%e5%a4%84%e7%90%86%e5%99%a8%e5%8a%a0%e8%bd%bd%e5%a4%b1%e8%b4%a5.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>使用FeedBurner烧制RSS最好禁用ItemLinkClicks统计</title>
		<link>http://www.imkevinyang.com/2010/02/%e4%bd%bf%e7%94%a8feedburner%e7%83%a7%e5%88%b6rss%e6%9c%80%e5%a5%bd%e7%a6%81%e7%94%a8itemlinkclicks%e7%bb%9f%e8%ae%a1.html</link>
		<comments>http://www.imkevinyang.com/2010/02/%e4%bd%bf%e7%94%a8feedburner%e7%83%a7%e5%88%b6rss%e6%9c%80%e5%a5%bd%e7%a6%81%e7%94%a8itemlinkclicks%e7%bb%9f%e8%ae%a1.html#comments</comments>
		<pubDate>Sun, 14 Feb 2010 16:08:00 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[FeedBurner]]></category>
		<category><![CDATA[FeedProxy]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[ItemLinkClicks]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[统计]]></category>
		<category><![CDATA[连接重置]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2010/02/%e4%bd%bf%e7%94%a8feedburner%e7%83%a7%e5%88%b6rss%e6%9c%80%e5%a5%bd%e7%a6%81%e7%94%a8itemlinkclicks%e7%bb%9f%e8%ae%a1.html</guid>
		<description><![CDATA[<p>我的博客一直用feedburner作为RSS服务提供商，挺不错的。博客地址变了也不用担心。而且Feedburner还提供了很多不错的服务，例如feed阅读统计，adsense集成之类的（虽然鄙人对广告非常讨厌，但是做网络营销效果量化分析职业的，如果自己对各种广告系统不熟悉的话，是非常不敬业的表现╮(&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>我的博客一直用feedburner作为RSS服务提供商，挺不错的。博客地址变了也不用担心。而且Feedburner还提供了很多不错的服务，例如feed阅读统计，adsense集成之类的（虽然鄙人对广告非常讨厌，但是做网络营销效果量化分析职业的，如果自己对各种广告系统不熟悉的话，是非常不敬业的表现╮(╯_╰)╭）。</p>
<p>我的博客以前是摘要输出的，如果用户看到感兴趣的内容，自然会点击feed然后跳转到我的博客上继续阅读全文。但是从去年年底的时候，当用户点击feed标题跳转到我的博客上的时候，中途却被连接重置了。我看了一下被重置的Url，是feedproxy.<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">google</a>.com域下的。为了确认不是我自己博客的问题，我又尝试在<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a> Reader中点好友的博客文章，也是一样的症状。说明feedproxy.<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">google</a>.com又被封了。于是我就将博客改成全文输出了。当时也没多想。</p>
<p>今天没事的时候又突然想起了这个问题：为什么点击feed会到feedproxy.<a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">google</a>.com而不是直接到我博客域名呢？是因为我用的是feedburner服务，所以Url被强制修改的缘故？</p>
<p>后来我又想起了feedburner的统计功能，它可以统计出每个feed条目都被查看和点击了多少次。难道是因为启用了这个分析功能才导致点击feed的时候先到了feedproxy再重定向到我博客的？为了验证我的想法，我在feedburner后台禁用了item link clicks统计功能，保留itemviews统计功能，重新同步了一下feed（重新同步的功能在troubleshootize菜单下）之后，刷新阅读器再次点击feed标题，果然就直接跳到我博客了，没有经过feedproxy这一步了。</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2010/02/image1.png" width="383" height="251" /> </p>
<p>貌似默认情况下是启用这两项分析的，所以估计很多用feedburner的中文博主都会遇到和我一样的问题。最好是和我一样把item link clicks功能给禁用了，那个功能可有可无吧。</p>
<p align="right">——<a title="使用FeedBurner烧制RSS最好禁用ItemLinkClicks统计" href="http://www.imkevinyang.com/2010/02/%e4%bd%bf%e7%94%a8FeedBurner%e7%83%a7%e5%88%b6RSS%e6%9c%80%e5%a5%bd%e7%a6%81%e7%94%a8ItemLinkClicks%e7%bb%9f%e8%ae%a1.html"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/feedburner" title="FeedBurner" rel="tag">FeedBurner</a>, <a href="http://www.imkevinyang.com/tags/feedproxy" title="FeedProxy" rel="tag">FeedProxy</a>, <a href="http://www.imkevinyang.com/tags/google" title="Google" rel="tag">Google</a>, <a href="http://www.imkevinyang.com/tags/itemlinkclicks" title="ItemLinkClicks" rel="tag">ItemLinkClicks</a>, <a href="http://www.imkevinyang.com/tags/rss" title="RSS" rel="tag">RSS</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a>, <a href="http://www.imkevinyang.com/tags/%e7%bb%9f%e8%ae%a1" title="统计" rel="tag">统计</a>, <a href="http://www.imkevinyang.com/tags/%e8%bf%9e%e6%8e%a5%e9%87%8d%e7%bd%ae" title="连接重置" rel="tag">连接重置</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2009/08/4%e8%a1%8cgreasemonkey%e4%bb%a3%e7%a0%81%e6%9c%80%e5%a4%a7%e5%8c%96google-reader%e7%9a%84%e9%98%85%e8%af%bb%e7%a9%ba%e9%97%b4.html" title="4行Greasemonkey代码最大化Google Reader的阅读空间 (2009/08/09)">4行Greasemonkey代码最大化Google Reader的阅读空间</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/03/android%e6%89%8b%e6%9c%ba%e5%88%9d%e4%bd%93%e9%aa%8c.html" title="Android手机初体验 (2010/03/01)">Android手机初体验</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/03/g1%e6%89%8b%e6%9c%ba%e4%b8%8e%e7%ac%94%e8%ae%b0%e6%9c%ac%e5%ae%9e%e7%8e%b0wifi%e4%ba%92%e8%81%94%e5%85%b1%e4%ba%ab%e4%b8%8a%e7%bd%91.html" title="G1手机与笔记本实现Wifi互联共享上网 (2010/03/02)">G1手机与笔记本实现Wifi互联共享上网</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/12/google-analytics%e4%b8%ad%e7%9a%84uniquepageview%e5%92%8cvisits%e7%9a%84%e5%8c%ba%e5%88%ab.html" title="Google Analytics中的UniquePageView和Visits的区别 (2009/12/07)">Google Analytics中的UniquePageView和Visits的区别</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/11/google-wave%e4%b8%ba%e4%bb%80%e4%b9%88%e8%bf%99%e4%b9%88%e7%81%ab.html" title="Google Wave为什么这么火 (2009/11/14)">Google Wave为什么这么火</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/05/google%e5%92%8c%e5%be%ae%e8%bd%af%e7%9a%84%e4%b8%80%e5%a4%a7%e4%b8%8d%e5%90%8c.html" title="Google和微软的一大不同 (2009/05/06)">Google和微软的一大不同</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/google%e5%b7%a5%e7%a8%8b%e5%b8%88matt-cutts%e8%b0%88seo.html" title="Google工程师Matt Cutts谈SEO (2009/03/23)">Google工程师Matt Cutts谈SEO</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/google%e6%8e%92%e5%90%8d%e6%9b%b4%e6%96%b0.html" title="Google排名更新 (2009/03/21)">Google排名更新</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/03/google%e7%9a%84%e4%bb%b7%e5%80%bc%e8%a7%82.html" title="Google的价值观 (2009/03/07)">Google的价值观</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/05/visual-studio%e7%bb%9f%e8%ae%a1%e6%9c%89%e6%95%88%e4%bb%a3%e7%a0%81%e8%a1%8c%e6%95%b0.html" title="Visual Studio统计有效代码行数 (2009/05/22)">Visual Studio统计有效代码行数</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2010/02/%e4%bd%bf%e7%94%a8feedburner%e7%83%a7%e5%88%b6rss%e6%9c%80%e5%a5%bd%e7%a6%81%e7%94%a8itemlinkclicks%e7%bb%9f%e8%ae%a1.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>解决WordPress升级后创建新页面时无法选择模板的问题</title>
		<link>http://www.imkevinyang.com/2009/12/%e8%a7%a3%e5%86%b3wordpress%e5%8d%87%e7%ba%a7%e5%90%8e%e5%88%9b%e5%bb%ba%e6%96%b0%e9%a1%b5%e9%9d%a2%e6%97%b6%e6%97%a0%e6%b3%95%e9%80%89%e6%8b%a9%e6%a8%a1%e6%9d%bf%e7%9a%84%e9%97%ae%e9%a2%98.html</link>
		<comments>http://www.imkevinyang.com/2009/12/%e8%a7%a3%e5%86%b3wordpress%e5%8d%87%e7%ba%a7%e5%90%8e%e5%88%9b%e5%bb%ba%e6%96%b0%e9%a1%b5%e9%9d%a2%e6%97%b6%e6%97%a0%e6%b3%95%e9%80%89%e6%8b%a9%e6%a8%a1%e6%9d%bf%e7%9a%84%e9%97%ae%e9%a2%98.html#comments</comments>
		<pubDate>Mon, 07 Dec 2009 06:21:00 +0000</pubDate>
		<dc:creator>Kevin Yang</dc:creator>
				<category><![CDATA[疑难杂症]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[新建页面]]></category>
		<category><![CDATA[模板]]></category>

		<guid isPermaLink="false">http://www.imkevinyang.com/2009/12/%e8%a7%a3%e5%86%b3wordpress%e5%8d%87%e7%ba%a7%e5%90%8e%e5%88%9b%e5%bb%ba%e6%96%b0%e9%a1%b5%e9%9d%a2%e6%97%b6%e6%97%a0%e6%b3%95%e9%80%89%e6%8b%a9%e6%a8%a1%e6%9d%bf%e7%9a%84%e9%97%ae%e9%a2%98.html</guid>
		<description><![CDATA[<p>这些天把wordpress升级到了最新版本2.8.6，升级的时候没有发现什么问题，等到今天打算创建一个新页面的时候发现原先右侧“选择新页面应用的模板”的下拉框消失了。一开始以为是新版本把这个功能移到别的地方了，结果找了半天也没找到。</p>
<p>选快速编辑的时候，倒是有下拉框，但是只有“默认模板”这一项。</p>
<p>&#16&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>这些天把wordpress升级到了最新版本2.8.6，升级的时候没有发现什么问题，等到今天打算创建一个新页面的时候发现原先右侧“选择新页面应用的模板”的下拉框消失了。一开始以为是新版本把这个功能移到别的地方了，结果找了半天也没找到。</p>
<p>选快速编辑的时候，倒是有下拉框，但是只有“默认模板”这一项。</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.imkevinyang.com/wp-content/uploads/2009/12/image_thumb4.png" width="214" height="109" />&#160; </p>
<p><a href="http://www.imkevinyang.com/tags/google" class="st_tag internal_tag" rel="tag" title="Posts tagged with Google">Google</a>上搜索了半天也没发现wordpress升级的时候有这个改动或者bug。后来以为是中文版的问题，就切回英文版，结果还是不行。</p>
<p>在快绝望的时候，尝试了一下把主题切换回默认的，然后再换回来现在使用的主题，居然神奇地找回了失落的“模板”项。</p>
<p align="right">——<a href="http://www.imkevinyang.com/"><em><strong>Kevin Yang</strong></em></a></p>

	标签：<a href="http://www.imkevinyang.com/tags/wordpress" title="WordPress" rel="tag">WordPress</a>, <a href="http://www.imkevinyang.com/tags/%e6%96%b0%e5%bb%ba%e9%a1%b5%e9%9d%a2" title="新建页面" rel="tag">新建页面</a>, <a href="http://www.imkevinyang.com/tags/%e6%a8%a1%e6%9d%bf" title="模板" rel="tag">模板</a>, <a href="http://www.imkevinyang.com/categories/techarticles/knottyproblems" title="疑难杂症" rel="tag">疑难杂症</a><br />

	<h4 style="background-color:#3B3B3B;border-bottom:2px groove gray;color:#F2F2F2;margin-top:20px;padding:6px 6px 6px 15px;margin:20px 0px 0px 0px">你可能对下面的文章感兴趣</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.imkevinyang.com/2009/04/dynamic-template%e9%9d%9e%e5%b8%b8%e5%a5%bd%e7%94%a8%e7%9a%84windows-live-writer%e5%8a%a8%e6%80%81%e6%a8%a1%e6%9d%bf%e6%8f%92%e4%bb%b6.html" title="Dynamic Template——非常好用的Windows Live Writer动态模板插件 (2009/04/09)">Dynamic Template——非常好用的Windows Live Writer动态模板插件</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/10/wordpress%e8%af%84%e8%ae%ba%e4%b8%ad%e4%bf%9d%e7%95%99html%e4%bb%a3%e7%a0%81.html" title="WordPress评论中保留Html代码 (2009/10/31)">WordPress评论中保留Html代码</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/08/%e5%8d%9a%e5%ae%a2%e7%a9%ba%e9%97%b4%e8%bf%81%e7%a7%bb%e4%b8%89%e6%ad%a5%e8%b5%b0.html" title="博客空间迁移三步走 (2009/08/21)">博客空间迁移三步走</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/12/%e5%9c%a8wordpress%e4%b8%ad%e8%bd%bb%e6%9d%be%e9%9b%86%e6%88%90google%e8%87%aa%e5%ae%9a%e4%b9%89%e6%90%9c%e7%b4%a2%e5%bc%95%e6%93%8e.html" title="在WordPress中轻松集成Google自定义搜索引擎 (2009/12/07)">在WordPress中轻松集成Google自定义搜索引擎</a> </li>
	<li><a href="http://www.imkevinyang.com/2009/10/%e8%a7%a3%e5%86%b3wordpress%e8%87%aa%e5%8a%a8%e5%b0%86%e5%8d%8a%e8%a7%92%e6%9b%bf%e6%8d%a2%e6%88%90%e5%85%a8%e8%a7%92%e7%9a%84%e9%97%ae%e9%a2%98.html" title="解决WordPress自动将半角替换成全角的问题 (2009/10/27)">解决WordPress自动将半角替换成全角的问题</a> </li>
	<li><a href="http://www.imkevinyang.com/2010/02/%e8%ae%a9%e5%8d%9a%e5%ae%a2%e4%b8%8d%e7%94%a8anti-spam%e6%8f%92%e4%bb%b6%e4%b8%80%e6%a0%b7%e6%b2%a1%e6%9c%89%e5%9e%83%e5%9c%be%e8%af%84%e8%ae%ba.html" title="让博客不用Anti-Spam插件一样没有垃圾评论 (2010/02/16)">让博客不用Anti-Spam插件一样没有垃圾评论</a> </li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.imkevinyang.com/2009/12/%e8%a7%a3%e5%86%b3wordpress%e5%8d%87%e7%ba%a7%e5%90%8e%e5%88%9b%e5%bb%ba%e6%96%b0%e9%a1%b5%e9%9d%a2%e6%97%b6%e6%97%a0%e6%b3%95%e9%80%89%e6%8b%a9%e6%a8%a1%e6%9d%bf%e7%9a%84%e9%97%ae%e9%a2%98.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.imkevinyang.com @ 2012-02-09 10:16:25 -->
