我正在尝试在 Visual Studio 2008 中调试Service项目,并且发现了这个问题 插入到Sub Main中以作为 Commandline App 运行的代码,但出现错误:
'The main entry point for the process
<mtathread()> _
<system.diagnostics.debuggernonusercode()> _
Shared Sub Main()
Dim serviceToRun As Service1 = New Service1 '"As Service1" editor says not defined!
If Environment.UserInteractive Then
serviceToRun.OnStart(Nothing)
Console.WriteLine("Press any key to stop the service")
Console.Read()
serviceToRun.OnStop()
Else
ServiceBase.Run(serviceToRun)
End If
End Sub
</system.diagnostics.debuggernonusercode()></mtathread()>
我在Google上进行了搜索,但只能找到CS示例。有人可以帮忙吗。