none
WindowsFormsApplicationBase.DoApplicationModel UnauthorizedAccessException RRS feed

  • Question

  • Hi,

    I am getting this exception on the window server 2008 R2 with framework 4.0. Its working fine the our testing server but when we run our application on production server (Window server 2008 R2) we are getting this exception. 

    Code: 

     public sealed class SingleInstanceManager : WindowsFormsApplicationBase

        {

            [STAThread]

            public static void Main(string[] args)

            { (new SingleInstanceManager()).Run(args); }

     

            public SingleInstanceManager()

            { IsSingleInstance = true; }

    Exception

    Description: The process was terminated due to an unhandled exception.

    Exception Info: System.UnauthorizedAccessException

    Stack:

       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])

       at FDM.TRS.ApplicationUI.SingleInstanceManager.Main(System.String[])

     

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

      <System>

        <Provider Name=".NET Runtime" />

        <EventID Qualifiers="0">1026</EventID>

        <Level>2</Level>

        <Task>0</Task>

        <Keywords>0x80000000000000</Keywords>

        <TimeCreated SystemTime="2012-01-23T07:55:29.000000000Z" />

        <EventRecordID>33994</EventRecordID>

        <Channel>Application</Channel>

        <Computer>LADA.fdm.local</Computer>

        <Security />

      </System>

      <EventData>

        <Data>Application: TestReportSystem.exe

    Framework Version: v4.0.30319

    Description: The process was terminated due to an unhandled exception.

    Exception Info: System.UnauthorizedAccessException

    Stack:

       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])

       at FDM.TRS.ApplicationUI.SingleInstanceManager.Main(System.String[])

    </Data>

      </EventData>

    </Event>

     

    Regards,

    Yasir

    Friday, January 27, 2012 6:56 AM

Answers

  • I think you need to access it with user log on.

    If the machine is no user logged on, when you run the application, the exception will throw.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Paul Zhou Thursday, February 9, 2012 8:47 AM
    Monday, January 30, 2012 9:06 AM

All replies

  • Check if it is because of UAC. You should disable UAC ( http://technet.microsoft.com/en-us/library/cc709691(WS.10).aspx ) and run the application ( Possibly as an administrator ).

    If it works, then you know what to fix.

    Friday, January 27, 2012 8:07 AM
  • Thanks for your reply. But This problem not always accurred. Sometime application work fine but sometime we face this problem.

     

    Regards,

    Yasir

    Friday, January 27, 2012 11:55 AM
  • In that case, there are resources which are being shared between this application and some other applications.

    And at times when this exception occurs, those particular resources are being owned by the other applications. So when your application tries to access those resources, it gets an exception.

    You can get more details by looking at the Inner-exception. Also check this site out, which assists in getting more detailed information http://msdn.microsoft.com/en-us/library/2bc80ssc(v=vs.90).aspx

    Monday, January 30, 2012 8:40 AM
  • I think you need to access it with user log on.

    If the machine is no user logged on, when you run the application, the exception will throw.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Paul Zhou Thursday, February 9, 2012 8:47 AM
    Monday, January 30, 2012 9:06 AM
  •  

    Hi Yasir,

     

    Has your issue been resolved? Would you mind letting us know the result of the suggestions?

     

    Now I will mark an answer, you can mark others that you think to be so useful to your issue.

    If you still have any questions about this issue, please feel free to let me know.  

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, February 9, 2012 8:47 AM