0
A
답변
3
당신이 찾고있는 것이 조금 분명합니다. Windows 서비스 Visual Studio의 프로젝트 유형은 기본 Windows 서비스로 이동하는 데 필요한 템플릿이 포함 된 프로젝트를 만듭니다.
this article은 C# Online에서 볼 수도 있습니다. 그것은 몇 가지 아이디어를 거쳐 기사에 몇 가지 부분이 있습니다. (주의 : 페이지가 약간 느려서 인내심을 가지고있는 것 같습니다.)
1
저는 VS2005를 사용하고 있으며 기본 템플릿부터 시작하겠습니다. http://msdn.microsoft.com/en-us/library/ddhy0byf(VS.80).aspx
작고 빠른 초기화 기능을 유지, 그렇지 않으면 서비스가 시작되지 않습니다 : 당신은 설치 프로그램을 추가 한 후
은 InstallUtil.exe는을 사용하여 설치이using System;
using System.ServiceProcess;
using System.Timers;
namespace WindowsService1
{
public partial class Service1 : ServiceBase
{
//better is to read from settings or config file
private readonly Double _interval = (new TimeSpan(1, 0, 0, 0)).TotalMilliseconds;
private Timer m_Timer;
public Service1()
{
InitializeComponent();
Init();
}
private void Init()
{
m_Timer = new Timer();
m_Timer.BeginInit();
m_Timer.AutoReset = false;
m_Timer.Enabled = true;
m_Timer.Interval = 1000.0;
m_Timer.Elapsed += m_Timer_Elapsed;
m_Timer.EndInit();
}
private void m_Timer_Elapsed(object sender, ElapsedEventArgs e)
{
//TODO WORK WORK WORK
RestartTimer();
}
private void RestartTimer()
{
m_Timer.Interval = _interval;
m_Timer.Start();
}
protected override void OnStart(string[] args)
{
base.OnStart(args);
Start();
}
protected override void OnStop()
{
Stop();
base.OnStop();
}
public void Start()
{
m_Timer.Start();
}
public new void Stop()
{
m_Timer.Stop();
}
}
}
에 서비스 클래스를 수정 서비스가시기 적절하게 응답하지 않았다는 오류
희망이 답변을드립니다.
관련 문제
- 1. C++ 멋진 템플릿 코드 문제
- 2. 멋진 템플릿 i18n
- 3. 멋진 템플릿 엔진
- 4. PHPUnit : 멋진 템플릿의 코드 범위
- 5. 멋진 템플릿 엔진 toturial로 검색하나요?
- 6. 멋진 템플릿 밖에서 멋진 기능을 사용할 수 있습니까?
- 7. Windows Installer Windows 서비스의 역할
- 8. 웹 서비스의 코드 인터프리터
- 9. Windows 서비스의 원격 설치
- 10. Windows 서비스의 WCF
- 11. Windows 서비스의 데이터베이스 액세스
- 12. Windows 서비스의 Wcf 라이브러리
- 13. Windows 서비스의 컨텍스트 실행
- 14. Windows 서비스의 어설 션
- 15. Windows 서비스의 SqlWebEventProvider
- 16. .net windows 서비스의 문제점
- 17. Windows 서비스의 기본 차트
- 18. Windows 서비스의 타이머
- 19. Windows 서비스의 TaskFactory
- 20. Windows 서비스의 ServiceController
- 21. Windows 서비스의 오류 처리
- 22. Windows 서비스의 HTTP 요청 문제
- 23. 북마크를 삽입하는 Eclipse 코드 템플릿?
- 24. .NET Windows 서비스의 이상한 문제
- 25. Windows 서비스의 데이터 동시성 문제
- 26. Windows 서비스의 이벤트 처리기 문제
- 27. Windows 서비스의 HttpWebRequest 시간 초과
- 28. Windows 서비스의 전체 경로 받기
- 29. Windows 서비스의 API는 어떻게 사용합니까?
- 30. Windows 서비스의 타이머 간격을 변경하십시오.