Presenter:Bob Tabor (from LearnVisualStudio.NET)
In this lesson, you will learn how to debug and monitor your ASP.NET 2.0 Web applications.
Click here to go to original video page
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
And is less a talk about how to debug your Web applications and how to monitor each webpage and how it performed internally by using the powerful functionality of visual Web developer 2005 express edition and ASP net 2 0 well in most challenging aspects of creating web based applications versus writing Windows forms applications elites in the past was the lack of tools to support debugging so that he could watch the code as it s executing that generates the dynamic webpages to watch it instead to rely my line and typically have to resort to writing out for race values at the top or the bottom of your webpage to get some feedback so you can narrow down which line or which lines of code or causing problems within your Web application
Minute 1
Taken a whole other level when deploying the web application I personally spent long hours trying to track down obscure bugs that only occurred in certain situations only to find out that it only occurred on people served in web browsers were disabled this and enable bad and so on and talk about a frustrating meticulous line of work so visual Web developer 2005 express edition makes it super easy to debug your applications during development time and fact immortals identically to the debugging tools are already using when building Windows forms applications in Visual Studio or visual C Sharkey thousand five express you can set and manage breakpoints you can view the values of variables and locals windows and watch windows and a lot more also ASP net 2 0 provides a tracing tool that makes monitoring how well your applications are functioning snap super easy and finally this lesson on the
Minute 2
Show how to set a default error page that you can use to give the user a friendly notice that something bad just happened instead showing an uglier page is generated automatically by the Web server you will make it very currently and show them a nice that your control at all times and so really demonstrate how to do that or he simply do in ASP net 2 0 okay so her to demonstrate the debugging features of visual Web developer 2005 express edition I want to create a new website today and read you something extremely simple just for the purpose writing some code I m going to drag and drop first of all a late goal a text box and a button to my designer surface is one matter how the range item going to want to change
Minute 3
Into a while but was also important to want to change the text box when to own first Xbox and will change your label to something like a result little to do in the Buffalo Clinton rewrites and code it is no matter what this does and a super simple string my straining my string equals first text box that texts and then we ll do result label text equals monster and very nonsensical but careful going to do with his example we are going to stop the execution of the button one click event by setting a breakpoint in our left hand column here in the way that I do that align 20 as I can merely does click this little grayish area over to left hand side in order to set up
Minute 4
Point can also use the F9 key on my keyboard in order to remove it I does click it again and is gone I can also set a breakpoint and then right click it and select disable the point of his reminds me that I may at some point in future want to stop my destitution my code right there in which case it s right click and select a table or I can remove it so that s how you set a breakpoint now we re running our application in debug mode by clicking the little green arrow that says start debugging were going to begin running our website as we normally do you see a little website developer server pop open but this time whatever we clicked the button control noticed that were back in the visual Web developer
Minute 5
Oak and that is a little yellow arrow that indicates that the next line of code to be executed will be now I have the full use of all Visual Studio style on debugging tools at my disposal for simple hem of the locals window down at the bottom that I can see the current value of my local variables including any objects are reference critics of this object for the webpage itself the event cards are passed into this particular event handler as well as the center I can also hover my mouse for sure over any of the objects that are reference in this case first text box type look at the visualizer in order to see the value saluted again here on the cover on Oscar sure for them to notice what was typed into the text property for example by running my mouse for sure is Wells all the properties that are set in this case the default
Minute 6
A use available here and I can step into each line of code by using my little debugging toolbar over here some use the step into button on the toolbar or execute a lot of code noticed that whenever executed that line of code it assigned value my string whatever a nonsense that I typed my keyboards you see now my string the value is read which means that he just changed and I conclude my little visualizer here in order to see this in a window there s a lot of text that would pop it open source and single one time a ride and I can continue executing my application by hitting the continue button or stepping to the I can even set what the next statement will be there will be executed at my immediate window or can change the value of my string if I wanted to on the fly so I could do this my string equals Volvo
Minute 7
Okay and I think that that should change see my string is now Bob Simon all of these whole tools of our disposal currently configuring application agency now that because I change the value my string in the immediate window I was able to then post the work bought to label a pistol how cool is it that you re able to work on a webpage develop it and the debug it in a advanced set of tools that allow you full fidelity control over the debugging experience very neat pace of the debugging tools are great whenever you re developing an application but what if you ve already deploy the application you re finding that some users are having problems and you can t re create those problems on your local of your local desktop machine but they re experiencing them whenever they use the public copy on the Internet or an intranet or whatever the case to be
Minute 8
There are some tracing features that are available that allow you to see behind the scenes how each your pages are executing a logical monitor the the values of the variables that are used within the webpage that allows you even write statements out to the school trace utility for debugging purposes that nobody else sees a castle show how to enable all that or they do is go to website and at the very bottom is the first one demonstrated this is this ASP net configuration utility selected and noticed that a little are all Web server pops open and I get this friendly website ministration tool for several things I can do with this tool and soap security including roles and users I configure the application I m working use that just a moment I can also set a provider configuration information for accessing on a
Minute 9
SQL files access files are small files and so on was click on application configuration noticed at we are now on the application tab over what threats and administration tools and I can see all versions are set for my application I can create application settings so so hard coding strings and save them in a friendly XML file and use this for little web interface to do that I can set up my e mail settings so that my website can successfully e mail from the webpages I can either start up or stop the application itself and I can also configure debugging and tracing information which is what really do right now idiocy here that we ve already have enabled blogging setup for application we could remove this if we want to however we re going to do is select capture
Minute 10
Houses to set some more on properties for tracing we can display tracing information on individual pages which is Howard and the start of except all the rest the fault of settings here will come back to this in just a moment and then click the back button and then I shut this down in the safer we have here and I m going to run my application again and when I do notice this time what happens up another so little because of use relative phone positioning for my controls we see a little bit of a run over here were my button is down into my tracing information we can modify this so that the request details come below the entire webpage to apologize for that but you still get an idea care of the trace information is enabled I can see at each given this step in the construction of our webpage
Minute 11
These Capri and it s staged a mid stage in a complete Paris load began and load load completes and so on call the way through to the render stage we can see the entire creation of our webpage how long it took to go to those given steps I d also look very language controls that are contained and the Harkey of the containers that can that contain each control we look at session state information application state information if we were to say values as well as values are in the cookies in the response object in the headers collection the response form query string server verbals does anything you possibly want to know about this webpage and the specific request to this webpage day acquittals that now in most cases you re not alone let everybody in the world see all the trace information
Minute 12
So how I go about hiding it from everybody else but crate is situated I can still look in and see what other people are experiencing on the website so we go back to her little configuration tool here go back to our application configuration tab select configure debugging and tracing and Ellis look of this we can display tracing information on individual pages and only display them for local requests over and over device that this to all request and everybody whoever visits my website will be able see all the tracing information by default it was set to local requests only when I m accessing the website from the same computer that is hosted on Will the trace information display focus was one way to manage it but there s also another way to do it as well and that is to deselect this display tracing information on individual pages and pay them by doing so
Minute 13
Now we have removed its source then saved as the hitting the back button closes down and run the application again and noticed now that the trace information is gone so where can I then view all the trace information is being collected from a webpage or through a special can lure special page called phrase A XD and when I get that page notice that I m able to now see a list of all the pages that were recently viewed weather was from mean viewing those pages or for any of the other users on the website that are looking at pages of my author Web server and I can see and set the number of requests that I should contain a short unavenged moment missile more a remaining Sophia high traffic website it might be easy to lose
Minute 14
So we may need to set a number higher to maybe 25 or 50 requests but now for all the individual request assumes a request for the fall that is the exit and click of your details become looking at all the trace information for four that given request and help this will help me debug the application only show you how not only does that trace information show you the value of local variables boy can also do here is type in some additional code for example on world do here is trace write this is something I wrote I could use this to provide feedback to me about how the application is executing more than a water
Minute 15
Come up with their a little happens whenever I run the application again I hit my webpage of the switch for Ace txt page looks so the trace of XT notice that now I have a second request at 10 07 a m a quick view details and now clean the page load and he and load I see the full message that I wrote out using the trace object is something I wrote although blah so I could ride out any values is to make sure that it s getting certain points within my code and that has proved very helpful over the years to help me debug small problems that have occurred in specific situations can and again I did all the rest information or here s well prequel
Minute 16
Ethical back to the ASP net configuration tool in Qu bec application look to configure and the tracing I can t opt that number of trace would court request from the default value tend to something off 50s so I can view many different requests that are coming in instead of just 10 at a time so put a higher volume with some meaning to do something like that okay so that s great now was a lot of talk what one less topic before we concluded that is what if problems occur on her website okay let me show you what can happen if you re not careful to comment out everything here for by selecting it to the comment button and then I m going to create some code that intentionally will break just to show you how bad things can happen to good webpages and so we created a user input in a juror were going to grab off the value assuming that s a measure day supply by three and in print that out to the
Minute 17
Label so in a perfect situation it would work like this open the value five footer button and be thought a 15 1 of her type and value Bob and click the button then stupid This and let us hit this page again unfortunately is fabulous and hard to reproduce recycled trouble what browser do not begin to build own and Titan were bought and click the button and notice that this is the only webpage that will appear to our end users unless we take some action to prevent that you get in an exception input string was not a correct format and this is the kind of information I want my end users to look at I would like for them to view a friendlier page to want to do is create an error page by selecting
Minute 18
At items clipped and just HTML page and close call this error htm and a loose type in something like you know something very simple great paragraph tag looks as if one ever go sorry you saw this we are experiencing problems plea uses try again and soon I give the look and feel of you know the rest of my website so it is not to be as bland as this particular pages of this idea can now in order for missiles page to pop up whenever an exception occurs I had to go to the the ASP net configuration tool select application configuration configure to bugging his tracing and then also book some sarin was
Minute 19
Act I apologized were on the application tab of our website administration tool on the select define default error page day in this allows me to specify URL to be used as the default error page on the select air htm AF select the save it and click okay and now in order to test that want to do is just open up another web browser and her go back to the same page it was just at a moment ago and get back to hear a great prototype involve and include a button right now we see here is the the the older a page this is because I m running this from the same machine were the website is hosted however other people will see this webpage
Minute 20
Exchange trust me on this guy tarted demonstrate from one computer but I hope you the idea that you can set it up so that whatever prof occurs that they will see a nice friendlier page instead of the ugly ASP net 2 0 default of a KB former close only do one other thing and that is solved the mystery of this neat little utility here this ASP net configuration tool that we been looking at what happens is what we make changes within this tool to those changes are saved to this mysterious web config file that s been added to our websites whenever we were starting to debug the application to open up this web config weary look at the sold in the previous video now we have really talked about that much but praise for you recall that we added some providers for
Minute 21
Our own profile properties in Korea but there s also similar studies in here as well notice for example this custom error for us of entry into this XML file noticed that we have this compilation to both equal true survivors have it ask us to want to enable debugging its setting that property in the web config also notice here we have a racing element has been as this XML file trace enabled it was true request legal 50 and the recent mother property set here as well the thing on the selections we make within this ASP net configuration tool so there s nothing to be you know amazed at her or there s nothing to be worried about if you make an incorrect selection but nothing magical going on all the settings are actually made this web config file which you can manually change it if you want to
Minute 22
So we ve talked about quite a few neat things in this lesson for small talk about debugging tools are available within visual Web developer notice how they re exactly the same as we ll been using and visual sea shark doesn t find warm Visual Studio in the past stuff out how to use the tracing features in order to ride out custom message is better than viewable on either the webpage the same webpage that were currently looking at or to a special handler called the trace of a XT allows us to review off to no 50 different web request the last 50 report request of common but take a look at how to set a default error page for the entire website and it also looked at were all the settings in that web application application configuration tool or actually saved in the web config file so hopefully this was not opener you learn a lot from this lesson
Minute 23
LaMotta were former videos just like this warning at all skill levels on many different topics related to see sharp Visual Basic ASP net in more think he
Thursday, May 29, 2008
Video: Debugging and Tracing Your Website C#
Labels:
debugging and tracing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment