Red Gate forums :: View topic - Can error reporting works on web applications?[solved]
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

Can error reporting works on web applications?[solved]

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
xavier



Joined: 29 Sep 2011
Posts: 4

PostPosted: Thu Sep 29, 2011 11:11 am    Post subject: Can error reporting works on web applications?[solved] Reply with quote

Hi,

Can somebody tell me if it's possible to use the error reporting feature with an ASP.Net MVC application?

Regards,

Xavier


Last edited by xavier on Fri Sep 30, 2011 1:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
xavier



Joined: 29 Sep 2011
Posts: 4

PostPosted: Thu Sep 29, 2011 1:32 pm    Post subject: partial answer Reply with quote

Because this assembly is a library. these options will not work automatically They will only work if accessed by an
EXE that has been processed by SmartAssembly, or if you call ExceptionReporting.Report (Exception) manually.
_________________
Regards,

Xavier
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6673

PostPosted: Thu Sep 29, 2011 5:54 pm    Post subject: Reply with quote

Or if you precompile the website and cerate an entry point for the resulting DLL as described here:
http://www.red-gate.com/supportcenter/Content?c=SmartAssembly%5chelp%5c6.2%5cSA_Errors_DLLs.htm&p=SmartAssembly
Back to top
View user's profile Send private message
xavier



Joined: 29 Sep 2011
Posts: 4

PostPosted: Fri Sep 30, 2011 1:45 pm    Post subject: Reply with quote

Thank you for your help
_________________
Regards,

Xavier
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6673

PostPosted: Thu Oct 06, 2011 11:02 am    Post subject: Reply with quote

I take that back.... you can't use error reporting with the DLL(s) produced by ASPNET_COMPILER.exe except using ExceptionReporting.Report() like Xavier said.

I'm trying to see if there is a better way of doing this where you can get the local variables as well as just the stack trace.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6673

PostPosted: Thu Oct 06, 2011 1:13 pm    Post subject: Reply with quote

Okay, here's how you make this work for ASP .NET, in a way that will also include the variable values:

  • Add a reference to c:\program files\red gate\smartassembly 6\SDK\bin\SmartAssembly.ReportException.dll in the web project
  • Open the codebehind file for Global.asax in Notepad (or VS)
  • If the method protected void Application_Error(Object sender, EventArgs e) does not exist, create it
  • The method should contain these lines
    Exception exc = Server.GetLastError().GetBaseException();
    SmartAssembly.ReportException.ExceptionReporting.Report(exc);
  • Save Global.asax.cs (or vb)
  • Use Aspnet_Compiler to create pre-compiled code for the website
    (aspnet_compiler -v "/" -p "c:\mywebsite" "c:\mynewwebsite")
  • Open the main DLL in a new SmartAssembly project (App_Web_xxx.dll)
  • Make sure to use the options to merge the dependent DLLs (especially Global_asax.dll)
  • Set up error reporting to report silently
  • Build the DLL into a new folder in a "bin" subfolder (c:\mynewSAwebsite\bin)
  • Copy all of the files that are not DLLs from the original compiled website to the one you just created

Using this method, you have created a global exception handler that will get the exception stack trace and local variables from the web application if it throws an unhandled exception.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6673

PostPosted: Fri Oct 07, 2011 1:46 pm    Post subject: Reply with quote

Slight correction to the above: Merging the DLLs seems to break the error reporting, although the applicaiton works fine. If you process all of the DLLs produced by ASP .NET Compiler and deploy them separately, that works much better.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group