public partial class MyNewService : ServiceBase
{
private DirectoryInfo imgDir;
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["b1"].ConnectionString);
string ImgName;
byte[] rImg;
public MyNewService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
//Here I am calling thread two ways i am doing but it gives same error
DoLongRunningStartupWork();
//or//
(new Thread(() => DoLongRunningStartupWork()){IsBackground = true}) .Start();
}
void DoLongRunningStartupWork()
{
/// This part contains whole program code
}