A refrigerating and air-conditioning apparatus comprising: a refrigeration cycle being formed by connecting a compressor, a condenser, expansion means, and an evaporator, the refrigeration cycle performing a cooling operation; an evaporator heating device heating the evaporator; a drain pan receiving drain-water from the evaporator and draining the drain-water; a drain-pan heating device heating the drain pan; frost detecting means including a light-emitting element that emits light to the evaporator and a light-receiving element that receives reflected light from the evaporator and outputs a voltage according to the reflected light; and a control device controlling on-off operation of the evaporator heating device and the drain-pan heating device, wherein the control device determines the frosting condition on the evaporator from an output of the frost detecting means and individually controls the evaporator heating device and the drain-pan heating device in accordance with the determination result, and characterized in that the frost detecting means is attached to the evaporator in a movable manner so as to be capable of detecting a frosting condition of the entire evaporator, and the control device determines ON timings of the evaporator heating device and the drain-pan heating device by making the frost detecting means detect the frosting condition in an area in the evaporator where a progression of frost formation is fast, and determines OFF timings of the evaporator heating device and the drain-pan heating device by making the frost detecting means detect the frosting condition in an area in the evaporator where a progression of defrosting is slow. a refrigeration cycle being formed by connecting a compressor, a condenser, expansion means, and an evaporator, the refrigeration cycle performing a cooling operation; an evaporator heating device heating the evaporator; a drain pan receiving drain-water from the evaporator and draining the drain-water; a drain-pan heating device heating the drain pan; frost detecting means including a light-emitting element that emits light to the evaporator and a light-receiving element that receives reflected light from the evaporator and outputs a voltage according to the reflected light; and a control device controlling on-off operation of the evaporator heating device and the drain-pan heating device, wherein the control device determines the frosting condition on the evaporator from an output of the frost detecting means and individually controls the evaporator heating device and the drain-pan heating device in accordance with the determination result, and characterized in that the frost detecting means is attached to the evaporator in a movable manner so as to be capable of detecting a frosting condition of the entire evaporator, and the control device determines ON timings of the evaporator heating device and the drain-pan heating device by making the frost detecting means detect the frosting condition in an area in the evaporator where a progression of frost formation is fast, and determines OFF timings of the evaporator heating device and the drain-pan heating device by making the frost detecting means detect the frosting condition in an area in the evaporator where a progression of defrosting is slow.