Finally found it, went to run->eventvwr. Then checked for errors. There was an error with COM exception. Then gave necessary access to the COM object following the instructions given for the error code by microsoft.
Basically the user machinename\asp.net did not have access to the scheduler exe which is present in the machine. While debugging it worked since i was the administrator, after hosting it did not work after giving necessary access it worked.