Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Simple C# app won't execute under Sql Server agent

$
0
0

Hi,

I wrote a C# program that I plan on running on a daily basis.  I've written similar program earlier that is in production, and it works just fine.  However, my new program when run under Sql Server Agent (2008) does not seem to execute the application.  So I wrote a really simple program to help debug the issue.  This program also does not execute.  I've looked at permissions, ran the job under the SA account, and tried various combinations of Powershell (i.e.,  "Invoke-Item", "&") and CmdExec.  I've talked to our DBA, and he finds nothing wrong.  I've also searched all of the forums.  All to no avail.

 Here is the script: 

Get-date >> \\dodevelop\rptdev\DKtoTKupdate\SqlJobTest\log.txt 
& "\\dodevelop\rptdev\DKtoTKupdate\SqlJobTest\SqlJobTest.exe"

The Get-date statement executes properly.  The program does not.  I have run both the program and the script successfully, independent of Sql Server Agent.  When run under Sql Server Agent, it does not produce any output.  Here is the program I want to execute:

namespace SqlJobTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string filename = "dummy.txt";
            string path = @"\\dodevelop\rptdev\DKtoTKupdate\SqlJobTest\";
            using (StreamWriter sw = new StreamWriter (path + filename, true))
            {
                sw.WriteLine("Hello World: {0}", DateTime.Now);
                sw.Close();
            }

        }
    }
}

Any help would be greatly appreciated.  I apologize if I've missed something really obvious.

Thanks in advance.

akibruin


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>