An unhandled Microsoft.NET Framework exception occured in w3wp.exe[7388] RRS feed

  • Question


    I am designing a web application using VS 2010 and SQL Server 2008.It was working fine but at one point i wrote the code to log exception to a text file.After that i am getting the following exception 

    "The Just-In-Time debugger was launched without necessary security permissions.To debug this process,the  Just-In-Time debugger must be run as an Administrator.Would you like to debug this process."

    Now if i comment this code (to log the exception),the application works perfectly without the exception.Can anyone tell me what is the problem and what this piece of code has to do with this exception?

    Here is my code to log the exceptions to text file:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.IO;
    using System.Globalization;
    /// <summary>
    /// Summary description for Logger
    /// </summary>
    public class Logger
    public Logger()
    // TODO: Add constructor logic here
        /// <summary>
        /// Write an error Log in File
        /// </summary>
        /// <param name="errorMessage"></param>
        public void LogError(Exception ex)
                string path = "~/Log/" + "Log.txt";
                if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath(path)))
                using (StreamWriter w = File.AppendText(System.Web.HttpContext.Current.Server.MapPath(path)))
                    w.WriteLine("\r\nLog Entry : ");
                    w.WriteLine("{0}", DateTime.Now.ToString());
                    string err = "Error in: " + System.Web.HttpContext.Current.Request.Url.ToString() +
                                  ". Error Message:" + ex.ToString();
            catch (Exception e)



    Software Engineer

    Monday, October 15, 2012 7:20 AM


  • Hi Syed,

    Welcome to the MSDN Forum.

    Please try this suggestion: http://forums.asp.net/t/1676502.aspx/1

    Change the ApplicationPoolIdentity of the application pool for your project to an account such as Local System.

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Mike Feng Thursday, October 25, 2012 10:46 AM
    Tuesday, October 16, 2012 8:49 AM