This project is read-only.

Attempting to profile Orchard using NHProf

Topics: Troubleshooting
Aug 25, 2011 at 8:08 PM
Edited Aug 25, 2011 at 8:08 PM

This may be more a question for NHProf than Orchard, but...

I am trying to profile Orchard using NHProf, but I am getting this exception - 

Attempt by security transparent method 'Orchard.Web.MvcApplication.Application_Start()' to access security critical method 'HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize()' failed.

Anyone else experienced/found a fix for this? I added a reference to the HibernatingRhinos.Profiler.Appender.v4.dll, and added the .Initialize() line to the Application_Start() event handler.

Subquestion - right now I am just trying to profile, period, but long term, it would probably make more sense to put the profiler initialization code into a module, rather than the global.asax of there an "app startup" event on any Orchard objects that I am overlooking?



Aug 25, 2011 at 8:13 PM

Are you running in full trust?

Aug 25, 2011 at 8:25 PM

Yup, running in full trust.

Aug 25, 2011 at 9:33 PM

If you want to see SQL logs you can use

I already saw this error in the discussion forums, and it was solved by adding some Security attribute in the assembly.cs.

If you want to register something when a tenant is started, you just need to implement  IOrchardShellEvents

Aug 25, 2011 at 10:35 PM

Thanks, Sebastien! On all accounts. The post you saw was here.

I kept thinking it was specific to nhprof, so I never searched the forums without that in the string.