Let's consider the following context:
You come to the office on Saturday and see somebody finish some actions and now (s)he is sitting at your workplace (you didn't expect to meet anyone), but anyway you are not surprised and just want to know what's happened.
There are at least two ways to ask your colleague:
What were you doing here?
What have you been doing here?
According to the rules I've learned, there is no big difference between these options.
Of course, our choice could depend on what my colleague is doing when I ask or other rules I don't know, but I do want to know what native speaker feels comparing these two questions in the above context and what the difference is.