Where do logs go when running asp net core on iis 7 5


ASP.NET is a popular language used for building web . It provides a framework for developing dynamic and web services. One common question that developers often encounter is where the logs go when running ASP.NET Core on IIS 7.5. In this article, we will explore this question and provide some examples to help clarify the concept.

Understanding ASP.NET Core and IIS 7.5

ASP.NET Core is a cross-platform, high-performance framework for building modern web applications. It can be hosted on various platforms, including IIS (Internet Information Services). IIS is a web server created by Microsoft that runs on Windows operating systems.

Logging in ASP.NET Core

Logging is an essential aspect of any application development process. It helps developers track and troubleshoot issues by recording relevant information runtime. ASP.NET Core provides a built-in logging framework that allows developers to log messages, exceptions, and other important events.

When running an ASP.NET Core application on IIS 7.5, the logs generated by the application are typically in the Windows Log. The Event Log is a centralized repository for storing system, , and application events. It provides a convenient way to view and analyze logs generated by various applications running on the server.

Example: Logging to the Event Log

Let's consider an example where we want to log an error message when an exception occurs in our ASP.NET Core application running on IIS 7.5. We can use the built-in logging framework to achieve this.

using Microsoft.Extensions.Logging;

public class HomeController : Controller
    private readonly ILogger _logger;

    public HomeController(ILogger logger)
        _logger = logger;

    public IActionResult Index()
            // Code that may throw an exception
        catch (Exception ex)
            _logger.LogError(ex, "An error occurred");


In this example, we inject an instance of the ILogger interface into our HomeController. We then use the ILogger.LogError to log the exception along with a custom error message. The logs will be to the Event Log, which can be accessed using the Event Viewer tool in Windows.


In conclusion, when running an ASP.NET Core application on IIS 7.5, the logs generated by the application are typically stored in the Windows Event Log. This provides a centralized repository for storing and analyzing logs. By using the built-in logging framework in ASP.NET Core, developers can easily log important events and troubleshoot issues effectively.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents