Access denied when running .exe with sql server job agent
.net, c#, console-application, sql-server
Solution
Your app is in the C:\Users\Admin folder (why????), and therefore would require someone either logged in as `Admin` or specifically granted access to that folder to be running it. It appears that (thankfully) `SQLSERVERAGENT` is not running with Admin rights.
Problem
I created a c# console app, and I'm trying to run it on a sql server job. I set the Type to "Operating System", and the command text as: ``` "C:\Users\Admin\Documents\Visual Studio 2010\Projects\JobsApp\JobsApp\obj\x86\Release\JobsApp.exe" ``` When I run the job, I get this: Executed as user: NT Service\SQLSERVERAGENT. Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'FeedLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied. So I give SQLSERVERAGENT access to the dll, but now I'm getting this: Executed as user: NT Service\SQLSERVERAGENT. The process could not be created for step 1 of job 0x3E702A92E3799D4995984DF6641604F2 (reason: Access is denied). The step failed. I'm thoroughly confused. Is there a different file that's needs access as well? What am I doing wrong? I'm using SQL Server 2012 and created the exe with Visual C# Express 2010. Thanks.