We report on the fabrication of field-effect transistors based on single and bilayers of the semiconductor WS2 and the investigation of their electronic transport properties. We find that the doping level strongly depends on the device environment and that long in-situ annealing drastically improves the contact transparency allowing four-terminal measurements to be performed and the pristine properties of the material to be recovered. Our devices show n-type behavior with high room-temperature on/off current ratio of ~106. They show clear metallic behavior at high charge carrier densities and mobilities as high as ~140 cm2/Vs at low temperatures (above 300 cm2/Vs in the case of bi-layers). In the insulating regime, the devices exhibit variable-range hopping, with a localization length of about 2 nm that starts to increase as the Fermi level enters the conduction band. The promising electronic properties of WS2, comparable to those of single-layer MoS2 and WSe2, together with its strong spin-orbit coupling, make it interesting for future applications in electronic, optical and valleytronic devices.