ankurgupta246 wrote:
Note: may be there is some security account problem as we run this code in development environment without installing, then it works fine.
Under which account type the service is running? Local Service, Network Service, Local System or User.
Try running it under Local System and check if the problem still persists?