ASP.NET cached aspx page & IIS logs
Is there any way to find out if ASP.Net runtime has served a cached copy of ASPX page or actually went through the page life cycle?
Here is my problem:
I'm seeing many entries in my IIS log files that were served successfully (200 OK). I've a corresponding logging code (Log4Net API) in the Session_Start and Application_BeginRequest() events that is logging every request to my DB with more details. I'm not seeing any corresponding entries in my SQL DB for some cases that should have been created by Log4Net code.
Are there any logs available to find out if a cached copy was served by .NET worker process?开发者_运维问答 Moreover, if my logging code would throw an exception, won't that show up as 500 in IIS logs?
The code is on Windows 2008 Server, IIS 7.
PS: If coding assembly resolve event and logging into a database can help track this? Can somebody point me to an example?
If you don't want to manually add more logging, then you could just turn on tracing. To turn on tracing, open up your web.config and find the ... tag. Set enabled="true", save the web.config, then you can go to http://{your site}/trace.axd and view the page trace events.
You can test to see if you can see caching calls by first viewing a page, then clicking away and going back to it, then checking the trace to see the differences in the events that are recorded. You should see cache fetching in the trace of the second page view.
Here's more info about this great feature from MS: http://msdn.microsoft.com/en-us/library/1y89ed7z(VS.71).aspx
You also have the ability in your code to write to the trace output using Trace.Write or Trace.Warn. It's a great way to add a bit of debugging code that will only run when Tracing is enabled.
HTH, Lance
精彩评论