2010-12-17 101 views
4

我试图将失败的请求跟踪添加到我的IIS 7/ASP.NET服务器。失败请求跟踪的IIS/ASP.net错误:“此内容的失败请求跟踪已存在”

首先,我为“all content, error codes 400-999”创建失败的请求跟踪,因为要保存所有错误。

然后,我尝试为“all content, time: 5 seconds”创建跟踪,因为我想跟踪所有“长”请求。但是,IIS 7给我一个错误:“此内容的失败请求跟踪已存在”。

如何为所有耗时> 5秒的内容添加此第二个跟踪?

alt text

回答

1

在你web.config失败请求跟踪配置看起来类似:

<tracing> 
    <traceFailedRequests> 
    <add path="*"> 
     <traceAreas> 
     <add provider="ASP" verbosity="Verbose" /> 
     <add provider="ASPNET" areas="Infrastructure, etc" verbosity="Verbose" /> 
     <add provider="ISAPI Extension" verbosity="Verbose" /> 
     <add provider="WWW Server" areas="Authentication, etc" verbosity="Verbose" /> 
     </traceAreas> 
     <failureDefinitions statusCodes="400-999" /> 
    </add> 
    </traceFailedRequests> 
</tracing> 

属性path定义的内容类型,即在添加FRT向导的第一个页面的选项(* * .aspx,* .asp,Custom)。

如果您检查在applicationHost.config(在system.webServer/tracing/traceFailedRequests部分位于%systemroot%\System32\inetsrv\ config\schema\IIS_schema.xml你会发现下面的约束模式:

失败请求路径必须是唯一的:

<attribute name="path" type="string" isUniqueKey ="true" /> 

在每一个路径提供者(ASP,ASPNET,ISAPI扩展等)必须是唯一的:

<attribute name="provider" type="string" required="true" isUniqueKey="true" /> 

如果您添加了其他[R跟踪规则跟踪相同的内容(*),但指定timeTaken那么你可以尝试添加:

当然
<add path="*"> 
    <traceAreas> 
    <add provider="ASP" verbosity="Verbose" /> 
    <add provider="ASPNET" areas="Infrastructure, etc" verbosity="Verbose" /> 
    <add provider="ISAPI Extension" verbosity="Verbose" /> 
    <add provider="WWW Server" areas="Authentication, etc" verbosity="Verbose" /> 
    </traceAreas> 
    <failureDefinitions statusCodes="400-999" /> 
</add> 

这与冲突模式中的其中说,该路径必须是唯一的规则。

但是,您可以执行的操作是指定timeTaken大于等于5秒时要跟踪的特定内容。

例如:

<add path="*.aspx"> 
    <traceAreas> 
    <add provider="ASP" verbosity="Verbose" /> 
    <add provider="ASPNET" areas="Infrastructure, etc" verbosity="Verbose" /> 
    <add provider="ISAPI Extension" verbosity="Verbose" /> 
    <add provider="WWW Server" areas="Authentication, etc" verbosity="Verbose" /> 
    </traceAreas> 
    <failureDefinitions timeTaken="00:00:05" statusCodes="400-999" /> 
</add> 
<add path="*.asp"> 
    <traceAreas> 
    <add provider="ASP" verbosity="Verbose" /> 
    <add provider="ASPNET" areas="Infrastructure, etc" verbosity="Verbose" /> 
    <add provider="ISAPI Extension" verbosity="Verbose" /> 
    <add provider="WWW Server" areas="Authentication, etc" verbosity="Verbose" /> 
    </traceAreas> 
    <failureDefinitions timeTaken="00:00:05" statusCodes="400-999" /> 
</add> 
<add path="*.asmx"> 
    <traceAreas> 
    <add provider="ASP" verbosity="Verbose" /> 
    <add provider="ASPNET" areas="Infrastructure, etc" verbosity="Verbose" /> 
    <add provider="ISAPI Extension" verbosity="Verbose" /> 
    <add provider="WWW Server" areas="Authentication, etc" verbosity="Verbose" /> 
    </traceAreas> 
    <failureDefinitions timeTaken="00:00:05" statusCodes="400-999" /> 
</add> 

不是很方便的只能够做一个通配符,但它是一种解决方法。