Congestion detection has become a hot issue in Networks-on-Chip. Congestion-Aware routing algorithms are designed to avoid congestion in the network; however, most of them achieve small performance benefits while drastically increasing the cost if the mesh size becomes larger. Using a different approach, we utilize the network itself to detect the congestion. In this paper, a congestion detecting mechanism is proposed, which is capable of locating where the congestion is in the network within several cycles. Then, the mechanism is applied to routing algorithm selection and task scheduling. The most suitable routing algorithm is selected according to the detection result. If the congestion status changes, the mechanism can also detect the change and judge whether the routing algorithm needs to be changed. Moreover, from the detection result, we can know the effect of task scheduling and judge whether it needs to be changed. Experimental results show that with the proposed detecting mechanism, the suitable routing algorithm is able to be successfully selected according to the congestion status and the better choice of task scheduling can be made. Consequently, the performance of NoC with the proposed congestion detection mechanism increases.