Active Reports

Discussion in 'ASP .Net' started by CsaaGuy, Aug 17, 2005.

  1. CsaaGuy

    CsaaGuy Guest

    I get OS errors when I run active reports from code.

    The first error is with this code (beware of the commented out code)


    Dim oPrinter As New System.Drawing.Printing.PrintDocument
    oPrinter.PrinterSettings.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    Dim oReport As New Report01
    'oReport.Document.Printer.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    oReport.ds.SQL = "Select * from tblAssignments, tblUsers where
    ClaimNumber = '08-M63254-4' and tblUsers.UserID =
    tblAssignments.AdjusterId"
    oReport.ds.ConnectionString =
    ConfigurationSettings.AppSettings("ConnectionStringTLW")
    oReport.Run()
    oReport.Document.Print(False, False)

    I get this error:

    An unhandled exception of type
    'System.Runtime.Serialization.SerializationException' occurred in
    Unknown Module.

    Additional information: The type
    System.Drawing.Printing.InvalidPrinterException in Assembly
    System.Drawing, Version=1.0.5000.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a is not marked as serializable.



    If i run it with this code (beware of the commented out code)

    'Dim oPrinter As New System.Drawing.Printing.PrintDocument
    'oPrinter.PrinterSettings.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    Dim oReport As New Report01
    oReport.Document.Printer.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    oReport.ds.SQL = "Select * from tblAssignments, tblUsers where
    ClaimNumber = '08-M63254-4' and tblUsers.UserID =
    tblAssignments.AdjusterId"
    oReport.ds.ConnectionString =
    ConfigurationSettings.AppSettings("ConnectionStringTLW")
    oReport.Run()
    oReport.Document.Print(False, False)

    I get this error:


    An unhandled exception of type 'System.ComponentModel.Win32Exception'
    occurred in Unknown Module.

    Additional information: The RPC server is unavailable

    As a Note, the report works in the webviewer.

    Thanks.
    CsaaGuy, Aug 17, 2005
    #1
    1. Advertising

  2. By default ASP.NET runs under the ASPNET user account, which has limited
    permissions. Specifically, this account does not have access to any
    printers. All the errors you recieved are related to this fact. Therefore
    you'll likely have better luck using impersonation to have ASP.NET run under
    another account.

    Here's more info on impersonation:
    http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "CsaaGuy" <> wrote in message
    news:...
    >I get OS errors when I run active reports from code.
    >
    > The first error is with this code (beware of the commented out code)
    >
    >
    > Dim oPrinter As New System.Drawing.Printing.PrintDocument
    > oPrinter.PrinterSettings.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    > Dim oReport As New Report01
    > 'oReport.Document.Printer.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    > oReport.ds.SQL = "Select * from tblAssignments, tblUsers where
    > ClaimNumber = '08-M63254-4' and tblUsers.UserID =
    > tblAssignments.AdjusterId"
    > oReport.ds.ConnectionString =
    > ConfigurationSettings.AppSettings("ConnectionStringTLW")
    > oReport.Run()
    > oReport.Document.Print(False, False)
    >
    > I get this error:
    >
    > An unhandled exception of type
    > 'System.Runtime.Serialization.SerializationException' occurred in
    > Unknown Module.
    >
    > Additional information: The type
    > System.Drawing.Printing.InvalidPrinterException in Assembly
    > System.Drawing, Version=1.0.5000.0, Culture=neutral,
    > PublicKeyToken=b03f5f7f11d50a3a is not marked as serializable.
    >
    >
    >
    > If i run it with this code (beware of the commented out code)
    >
    > 'Dim oPrinter As New System.Drawing.Printing.PrintDocument
    > 'oPrinter.PrinterSettings.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    > Dim oReport As New Report01
    > oReport.Document.Printer.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
    > oReport.ds.SQL = "Select * from tblAssignments, tblUsers where
    > ClaimNumber = '08-M63254-4' and tblUsers.UserID =
    > tblAssignments.AdjusterId"
    > oReport.ds.ConnectionString =
    > ConfigurationSettings.AppSettings("ConnectionStringTLW")
    > oReport.Run()
    > oReport.Document.Print(False, False)
    >
    > I get this error:
    >
    >
    > An unhandled exception of type 'System.ComponentModel.Win32Exception'
    > occurred in Unknown Module.
    >
    > Additional information: The RPC server is unavailable
    >
    > As a Note, the report works in the webviewer.
    >
    > Thanks.
    >
    Steve C. Orr [MVP, MCSD], Aug 17, 2005
    #2
    1. Advertising

  3. CsaaGuy

    CsaaGuy Guest

    Steve C. Orr [MVP, MCSD] wrote:
    > By default ASP.NET runs under the ASPNET user account, which has limited
    > permissions. Specifically, this account does not have access to any
    > printers. All the errors you recieved are related to this fact. Therefore
    > you'll likely have better luck using impersonation to have ASP.NET run under
    > another account.
    >
    > Here's more info on impersonation:
    > http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >

    It does some and thanks. I curious, why does it run from the web viewer?
    CsaaGuy, Aug 17, 2005
    #3
  4. The web viewer sounds like a client side component, and the client does have
    access to the printer.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "CsaaGuy" <> wrote in message
    news:...
    >
    > Steve C. Orr [MVP, MCSD] wrote:
    >> By default ASP.NET runs under the ASPNET user account, which has limited
    >> permissions. Specifically, this account does not have access to any
    >> printers. All the errors you recieved are related to this fact.
    >> Therefore
    >> you'll likely have better luck using impersonation to have ASP.NET run
    >> under
    >> another account.
    >>
    >> Here's more info on impersonation:
    >> http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr, MCSD, MVP
    >> http://SteveOrr.net
    >>

    > It does some and thanks. I curious, why does it run from the web viewer?
    >
    Steve C. Orr [MVP, MCSD], Aug 18, 2005
    #4
  5. CsaaGuy

    CsaaGuy Guest

    Ah, thats it. Its an Activex Report Viewer. Thank you again.


    Steve C. Orr [MVP, MCSD] wrote:
    > The web viewer sounds like a client side component, and the client does have
    > access to the printer.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "CsaaGuy" <> wrote in message
    > news:...
    > >
    > > Steve C. Orr [MVP, MCSD] wrote:
    > >> By default ASP.NET runs under the ASPNET user account, which has limited
    > >> permissions. Specifically, this account does not have access to any
    > >> printers. All the errors you recieved are related to this fact.
    > >> Therefore
    > >> you'll likely have better luck using impersonation to have ASP.NET run
    > >> under
    > >> another account.
    > >>
    > >> Here's more info on impersonation:
    > >> http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
    > >>
    > >> --
    > >> I hope this helps,
    > >> Steve C. Orr, MCSD, MVP
    > >> http://SteveOrr.net
    > >>

    > > It does some and thanks. I curious, why does it run from the web viewer?
    > >
    CsaaGuy, Aug 18, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Barnes
    Replies:
    1
    Views:
    578
    J Jones
    Feb 18, 2004
  2. Peri
    Replies:
    1
    Views:
    2,974
    =?Utf-8?B?Um90aGFyaWdlcg==?=
    Jul 21, 2005
  3. Replies:
    2
    Views:
    880
  4. Rod
    Replies:
    2
    Views:
    1,787
  5. Replies:
    0
    Views:
    486
Loading...

Share This Page