【问题标题】:IIExpress tracelog fileIIS Express 跟踪日志文件
【发布时间】:2013-07-16 12:44:27
【问题描述】:

我正在调试一个 asp.net mvc 4 网站 wsccc1。为了跟踪任何错误,我在 web.config 中设计了我的跟踪文件日志。我使用 Visual Studio 2012,默认托管服务器是 IIS Express。

<?xml version="1.0"?>
<configuration>
   <system.web>
     <compilation debug="true" targetFramework="4.5"/>
     <httpRuntime targetFramework="4.5"/>
     <customErrors mode="Off"></customErrors>
   </system.web>
   <system.serviceModel>
     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
     <serviceActivations>
     <add factory="System.ServiceModel.Activation.WebServiceHostFactory"
    relativeAddress="wscccService.svc"
    service="service.wservice"/>
  </serviceActivations>
  <baseAddressPrefixFilters>
    <add prefix="http://localhost:8080/" />
  </baseAddressPrefixFilters>
  </serviceHostingEnvironment>
 <behaviors>
  <serviceBehaviors>
      <behavior>
        <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
  </serviceBehaviors>
 </behaviors>
 <diagnostics>
     <messageLogging logEntireMessage="true"
              logMessagesAtServiceLevel="false"
              logMessagesAtTransportLevel="false"
              logMalformedMessages="true"
              maxMessagesToLog="5000"
              maxSizeOfMessageToLog="2000">
 </messageLogging>
</diagnostics>
</system.serviceModel>
 <system.webServer>
    <validation validateIntegratedModeConfiguration="true" />
    <handlers>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
   </system.webServer>
 <system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
        <add name="messagelistener"
         type="System.Diagnostics.XmlWriterTraceListener"
              initializeData="C:\myMessages.svclog"></add>
     </listeners>
  </source>
  </sources>
    <trace autoflush="true"></trace>
  </system.diagnostics>

但我在 C 盘中找不到任何 .svclog 文件。路径'C:\Users\hui\Documents\IISExpress\TraceLogFiles\wsccc1'中有日志文件。所有文件都以“fr”开头,例如“fr00400.xml”。 有异常信息。

我的问题是为什么它以“fr”开头?它是指法语但我在美国吗?

还有为什么我无法生成“C:\myMessages.svclog”。

【问题讨论】:

    标签: wcf iis asp.net-mvc-4 iis-express


    【解决方案1】:

    C:\Users\hui\Documents\IISExpress\TraceLogFiles\wsccc1 中的文件是 IIS 日志文件:HTTP 请求 url + 响应状态 + 时间戳 +.... HttpLoggingModule 是必需的,它与 WCF 甚至 asp.net 无关。

    *.svclog 是 WCF 跟踪文件:这通常需要编辑配置文件以启用 WCF 跟踪(就像您所做的那样)。一个很好的教程是here

    还有为什么我无法生成“C:\myMessages.svclog”。

    也许是出于安全考虑。为 C 盘上的每个人添加完全控制权(不推荐)或指定一个公共目录(例如 c:\logs),每个人都可以在其中生成跟踪日志。

    编辑:

    为什么 IIS 日志文件以“fr”开头?

    即使我是法国人,它也不是为我们制作的。 fr 在这里表示请求失败。这是 IIS 中称为“失败的请求跟踪”的新功能:它旨在缓冲请求的跟踪事件,并且仅在请求“失败”时将它们刷新到磁盘。解释 here

    【讨论】:

    • 为什么 IIS 日志文件以 'fr' 开头?
    • 日志文件的路径在以下文件中:下的applicationhost.config
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-11
    • 2011-08-09
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    • 2017-06-27
    • 1970-01-01
    相关资源
    最近更新 更多