Asp.Net 4.0 Profiling on IIS7 - asp.net

New to both Asp.Net 4.0 and IIS7 deployment.
I am having a runtime problem with my application. Basically certain pages are not loading, also looks like a memory issue related to certain calls etc.
What are some of the tools and techniques for profiling/debugging Asp.net 4.0 when deployed on iis7. I am just looking for a way to get the BIG picture and the drill down to smaller level.
Is it suggested that any profiling of value take place in VS2010?

You can use iis7 failed request logs to track which handler is causing pages to fail out. Using this approach, you can narrow down where the issue is happening, and then use asp.net page level tracking and exception stack traces in your event log to solve the problem. Also, good logging in your global.asax application_error method is always recommended.

Related

ASP.NET warmup/initialize

I'm trying to eliminate (or at least minimize) startup/warmup times for my .NET applications. I'm not really sure on how to do this even though it's a common concern.
There's a ton of questions about slow startup of .NET applications. These are easily explained by pool recycles, worker process startup, dynamic compilation of .aspx files, JIT etc. In addition, there are more things that may need to be initialized within the application such as EntityFramework and application caches.
I've found alot of different solutions such as:
ASP.NET Precompilation
IIS 8 Application Initialization (and for IIS 7.5)
Auto-Start ASP.NET Applications
However, I'm not entirely satisfied with any of the solutions above. Furthermore I'm deploying my applications to Azure Websites (in most cases) so I have limited access to the IIS.
I know that there are some custom "warmup scripts" that uses various methods for sending requests to the application (e.g. wget/curl). My idea is to create a "Warmup.aspx" page in each of my ASP.NET applications. Then I have a warmup service that sends an HTTP GET to the Warmup.aspx of each site every ... 5 minutes. This service could be a WorkerRole in Azure or a Windows Service in an on-premise installation. Warmup.aspx will will then do the following:
Send an HTTP GET to each .aspx-file within the application (to
dynamically compile the page)
This could be avoided by precompiling the .aspx pages using aspnet_compiler.exe
Send a query to the database to
initialize EntityFramework
Initialize application caches etc
So, my final question is whether there are better alternatives than my "Warmup.aspx" script? And is it a good approach or do you recommend some other method? I would really like some official method that would handle the above criteria.
Any and all suggestions are welcome, thanks!
Did you try this IIS Auto-Start feature described here ?
https://www.simple-talk.com/blogs/2013/03/05/speeding-up-your-application-with-the-iis-auto-start-feature/
You could have two instances of the site. When you need to deploy a new version, and therefore suffer a startup cycle, remove one instance out of load balancer rotation, deploy and start it, set it in and do the same for instance 2. A rolling deployment.

how to do logging in asp.net application IIS?

i have a asp.net web application written about 2 years ago .It does not have any logging mechanism in it. Ideally I would like to log any errors that happen especially at the database level. I cannot afford to break the application however, and I have limited time.
I have heard about ELMAH. Is it possible to have something that doesn't talk to my code directly and just does its own thing by monitoring the server?
It was made in ASP.NET 3.5.
It has AJAX as well as heavy use of ViewState.
The application also communicates with Excel.
It is built in Visual Studio 2008 w/ SQL Server 2005 on the backend.
How do I go about deploying this website with above requirements?
Yes.
Added ELAMH to your application - it will log the errors. It's non-invasive.
Once ELMAH is added to your application it hooks into the OnError Event and captures all errors throw by your application. This is assuming that your application does not swallow the errors.
The documentation around ELMAH is through and easy to follow.
There is also log4net -
http://logging.apache.org/log4net/

Logging in ASP.NET

Is there any logger to asp.net like the System.ServiceModel.MessageLogging used in WCF?
There is health monitoring: http://msdn.microsoft.com/en-us/library/ff650305.aspx. It has a bunch of predefined events, plus you can create your own custom events for tracking purposes.
You could use log4net for this... log4net Website
Not sure what you are actually asking for. There is ASP.NET tracing and trace.axd handler to browsing traces.
After having used it myself, I'd like to suggest ELMAH:
ELMAH (Error Logging Modules and
Handlers) is an application-wide error
logging facility that is completely
pluggable. It can be dynamically added
to a running ASP.NET web application,
or even all ASP.NET web applications
on a machine, without any need for
re-compilation or re-deployment.

asp:Menu Not working on webhost

I'm using Visual Studio Web Express 2008 to develop an ASP.Net website. I have a master page that every page inherits from and on that master page I have the asp:menu control. On my local machine the menu control works just fine. The javascript is emitted and the links work as well.
However, when I upload it to my webhost service provider, the javascript is not emitted and my links do not work. I'm getting a feeling that my service provider really doesn't know much about .Net as they suggested that I make sure that I upload the .js files which isn't necessary.
Does anyone have any suggestions that I can give them? They're asking me what requirements are needed. It seems to me that something is not setup on their server properly but according to them, they have .Net 3.5 SP1 installed.
Everything for the control should be in the framework (no extra steps necessary); make sure in IIS they set it up to use the 2.0 version of the framework (which is probably the case)...
The cases of errors where I've seen that is when the framework isn't installed.
there is an http debugging tool called fiddler that will help you to see what is going wrong with the menu and related site resources. See the requests those are returing 404 and it will help you a lot to head towards the solution faster

What Conditions Cause a Web Application to Be Just In Time Compiled?

I'm curious as to the exact conditions that cause an application to be Just In-Time Compiled?
I think we all know the first visit to a non pre-compiled site will cause a JIT.
What about throwing new code into the App_Code directory?
I'm pretty sure some actions like saving the web.config simply cause the cause the Application Pool to unload and so far I'm a little confused as to which action has which result.
I'd love to get a link to some good MS documentation or failing that the thoughts of an ASP.NET all star.
Thanks in advance!
Understanding ASP.NET Dynamic Compilation
ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0, section "Compilation Life Cycle"

Resources