我正在尝试编写一个Windows服务。它安装正常,但运行时出现以下异常时失败。我搜索了字符串“MyNewProgramService”,但我找不到任何会导致此错误的转换。我还将try/catch块添加到具有自定义异常处理的一堆代码中,而无需查找发生此异常的位置。我想这是在自动生成的配置/设置代码中的某个地方。有任何想法吗?Windows服务在启动时失败
Event Type: Error
Event Source: MyNewProgram Event
Category: None Event
ID: 0
Date: 4/15/2010
Time: 12:48:34 PM
User: N/A
Computer: 20F7KF1
Description: Service cannot be started. System.InvalidCastException:
Conversion from string "MyNewProgramService" to type 'Integer' is not valid. --->
System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value,
NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
at TaskManagerFailureHandlerService.MyNewProgramService.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
顺便说一句 - 我在VS2010上工作。 – Jeff 2010-04-15 17:12:41