Search code examples
wcfiisasp.net-mvc-4iis-express

IIExpress tracelog file


I am debugging an asp.net mvc 4 web site wsccc1. To traced any error, I designed my trace file log in web.config. I use Visual Studio 2012, the default hosted server is 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>

But I couldn't find any .svclog file in C drive. There are log files in the path 'C:\Users\hui\Documents\IISExpress\TraceLogFiles\wsccc1'. All the files begin with 'fr' such as 'fr00400.xml'. It has the exception information.

My question is why it begin with 'fr'? Is it referred to French but I am in USA?

Also why I could not generate 'C:\myMessages.svclog'.


Solution

  • Files in C:\Users\hui\Documents\IISExpress\TraceLogFiles\wsccc1 are IIS logs files : HTTP request url + response status + timestamp +.... HttpLoggingModule is required for this and it's not related to WCF or even asp.net.

    *.svclog are WCF trace files : this generally requires to edit the configuration file in order to enable WCF tracing (as you did). A good tutorial is here.

    Also why I could not generate 'C:\myMessages.svclog'.

    Maybe because of security. Add full control to everyone on C Drive (not recommanded) or specify a public directory (such as c:\logs) where everyone could generate trace logs.

    Edit :

    Why IIS log files begin with 'fr'?

    Even if i'm french it's not made for us. fr means here Failed Request. It's a new feature in IIS called "Failed Request Tracing" : it is designed to buffer the trace events for a request and only flush them to disk if the request "fails. Explanation here.