title: ASP NET MVC full stack trace for exception in production
body: <p>I have an ASP.NET MVC application and I log exceptions to email. It works fine from a local machine but when deployed to production, I don't get a full stack trace for the exception. It just reports <code>"System.NullReferenceException: Object reference not set to an instance of an object at MyApplication.Web.Controllers.AccessController.Index()"</code>. </p>
  
  <p>How can I get full stack trace including line numbers? Thanks! </p>
  
  <pre><code>namespace MyApplication.Web.Controllers
  {
    public class AccessController : Controller
    {
  
      public ActionResult Index()
      {
        try
        {
          //code
        }
        catch (Exception ex)
        {
          var exceptionString = ex.ToString();
          //Send email 
        }
      }
    }
  }
  </code></pre>