It's bound to happen, no matter how good of an employee you might be, there will more than likely be a time where you are going to annoy the boss. Sometimes it might be right and just, but other times it might be for no fault of your own and the boss is just looking for someone to blame and to take it out on. Either way, you need to know how to handle the boss when this kind of situation arises. The last thing you want is to end up in the job search line with the multitude of job seekers out there in today's unemployment lines.
The most important thing you can do in this situation is to keep calm and composed, especially if you know that you did nothing wrong. It simply doesn't matter at this point. You're the focus of your boss and no matter what you are the one in the hot seat. It's in our nature to go on the defense but we need to fight that urge to bark back. It will only make matters worse, plain and simple.
As you take in the information or fire that your boss may be throwing at you, stay calm and take it all in while still showing respect for the boss during the whole tirade he might be throwing at you. Even if you know for a fact that it was not something that you did, promise him that you will do everything you can to fix the situation and improve upon it.
You need to do your best to try and end this kind of conversation as quickly as you possibly can. The reason for this is that you boss might start getting angrier and angrier the more he goes on and on talking. Do your best to try and get out of the conversation with tact.
After all of the fuss is over from the confrontation it's a good idea to try and reach out to your boss in a sincere manner. Approach him and ask him if he has any suggestions on how you can improve your performance on the job. This will help to get rid of any blowups in the future but it's going to make you look good at the same time. He'll start seeing you as someone who knows how to take the initiative and that you are looking for a future with the company.
If you are not sure if what you are doing is wrong, make sure that you talk to other employees and ask them what they have noticed and if they might have any suggestions that might help you improve the things that you do. Get the advice from veteran employees that probably have been in the same situation as you.
If you improve your performance and you still can't seem to please the boss no matter how hard you try then as a last resort you may have to turn to your boss's boss and let them know that you don't believe that your boss is giving you a fair shot and that you feel they are being unreasonable. Make sure that you have facts to back this up before doing such a thing.