That normally happens when there's something wrong with your web server (IIS/Apache) configuration. First make sure that the web server user has write permissions to the $cfg->dataroot folder.
Then make sure that there is no closing PHP tag (?>) at the end of your Moodle config.php file.