, 나는 서비스가 다음 코드를 사용하여 TS에서 실행중인 검색하기 위해 노력하고 사전에 터미널 서버에서 실행중인 서비스를 추가 할 때 :Null 참조 문제 VB.NET에서
이Imports System.ServiceProcess
...
Dim dictservice As Generic.Dictionary(Of String, Services)
Public Sub GetService()
Dim localServices As ServiceController() = ServiceController.GetServices()
For Each service As ServiceController In localServices
dictservice.Add(service.DisplayName, New Services(service.DisplayName, service.ServiceName, service.Status.ToString))
Next
End Sub
내 서비스 클래스입니다 다음과 같이
Class Services
Private _displayName As String
Private _serviceName As String
Private _serviceStatus As String
Sub New(ByVal DisplayName As String, ByVal ServiceName As Object, ByVal ServiceStatus As String)
_displayName = DisplayName
_serviceName = ServiceName
_serviceStatus = ServiceStatus
End Sub
Public Overrides Function ToString() As String
Return _serviceStatus
End Function
End Class
내가 그것을 사전 표시 이름 채울 것으로 보인다 디버그 모드를 통해 단계 : 응용 프로그램 환경 서비스 이름 : AElookUpSVC 서비스 상태를 : 실행을
Null reference exception was unhandled: Object reference not set to an instance of an object.
가 널 참조를 찾는 어디 내 인생 해결할 수 없기 : (4)
이 때 내가 다음과 같은 오류가 다음 항목에 이동하려고?
미래에는 새로운 질문을 다시하지 말고 기존 질문에 새 정보를 편집하십시오. 감사. – Kev
질문을 삭제하면 다른 사람들이 답변을 해석하는 것이 훨씬 어려워집니다 ... – ForeverWintr