Access denied when running .exe with sql server agent

I created a C # console application and I am trying to run it on a SQL server.

I set Type to "Operating System" and the command text:

"C:\Users\Admin\Documents\Visual Studio 2010\Projects\JobsApp\JobsApp\obj\x86\Release\JobsApp.exe" 

When I run the task, I get the following:

Run as user: NT Service \ SQLSERVERAGENT. Unhandled exception: System.IO.FileLoadException: Failed to 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 get the following:

Run as user: NT Service \ SQLSERVERAGENT. The process cannot be created for step 1 of job 0x3E702A92E3799D4995984DF6641604F2 (reason: access is denied). Failed to complete the step.

I am completely confused. Is there another file that needs access? What am I doing wrong?

I am using SQL Server 2012 and creating exe with Visual C # Express 2010.

Thanks.

+4
source share
1 answer

Your application is located in the C: \ Users \ Admin folder (why ????) and therefore requires that someone either log in as Admin or specifically grant access to this folder to run it. It seems that (fortunately) SQLSERVERAGENT does not work with administrator privileges.

+3
source

All Articles