[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Window Service

Asked by daruffin in Sharp Zaurus Operating System, Microsoft Visual Basic.Net, Web Services and WCF

Tags: Microsoft Visual Studio 2005

I have tried to Develop a Window Services which will run a VB.net application on a Timer, Also I have created a Installation program for the Service, but when I run it, services Login pops up and when I suppy the user name and password, it say it not a trust account or domain name fail. I have given the user administrator right and it will not work.

Also I have created a bat file and tried to runs this and nothg still does not happen.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
'Web Service.vb
 
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Configuration
Imports System.Data
Imports System.Web.Services
Imports System.Diagnostics
Imports System.ServiceProcess
Imports System.IO
Namespace mcWebService
    Public Class WinService1 : Inherits System.ServiceProcess.ServiceBase
        Private oTimer As System.Threading.Timer
        Dim MyProcess As New Process
        Private components As System.ComponentModel.Container
        Public Sub New()
            ' This call is required by the WinForms Component Designer.
            InitializeComponent()
 
            ' TODO: Add any initialization after the InitComponent call
        End Sub
 
        ' The main entry point for the process
        Shared Sub Main()
            Dim ServicesToRun As System.ServiceProcess.ServiceBase()
 
            ' More than one user Service may run within the same process. To add
            ' another service to this process, change the following line to
            ' create a second service object. For example,
            '
            '   ServicesToRun = New System.ServiceProcess.ServiceBase[] {new WinService1(), new MySecondUserService()};
            '
            ServicesToRun = New System.ServiceProcess.ServiceBase() {New WinService1()}
 
            System.ServiceProcess.ServiceBase.Run(ServicesToRun)
        End Sub
        Private Sub InitializeComponent()
            Me.components = New System.ComponentModel.Container()
            '@this.TrayAutoArrange = true;
            '@this.TrayLargeIcon = false;
            Me.ServiceName = "mcWinService"
        End Sub
        Protected Overrides Sub OnStart(ByVal args() As String)
            ' Add code here to start your service. This method should set things
            ' in motion so your service can do its work.
            Dim objStreamWriter As System.IO.StreamWriter
            Dim strFName As String
            Dim oCallback As New Threading.TimerCallback(AddressOf OnTimedEvent)
            oTimer = New System.Threading.Timer(oCallback, Nothing, 6000, 6000)
 
 
            MyProcess.StartInfo.FileName = "C:\Program Files\VBCC_Wireless\VBCC_WirelessInstaller\Window_DataAutomation.exe"
            MyProcess.StartInfo.CreateNoWindow = True
            MyProcess.Start()
 
 
            strFName = "C:\VBScan\Log\mcWindowsService.txt"
 
            If File.Exists(strFName) Then
                Dim FILENAME As String = strFName
                objStreamWriter = File.AppendText(FILENAME)
                objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
                objStreamWriter.WriteLine("VB_WinService: Service Started " & Constants.vbLf)
                objStreamWriter.Flush()
                objStreamWriter.Close()
            Else
                objStreamWriter = File.CreateText(strFName)
                objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
                objStreamWriter.WriteLine(" VB_WinService: Service Started " & Constants.vbLf)
                objStreamWriter.Flush()
                objStreamWriter.Close()
            End If
        End Sub
 
        Protected Overrides Sub OnStop()
            ' Add code here to perform any tear-down necessary to stop your service.
            Dim objStreamWriter As System.IO.StreamWriter
            Dim strFName As String
            strFName = "C:\VBScan\Log\mcWindowsService.txt"
 
            If File.Exists(strFName) Then
                Dim FILENAME As String = strFName
                objStreamWriter = File.AppendText(FILENAME)
                objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
                objStreamWriter.WriteLine("VB_WinService: Service Started " & Constants.vbLf)
                objStreamWriter.Flush()
                objStreamWriter.Close()
            Else
                objStreamWriter = File.CreateText(strFName)
                objStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
                objStreamWriter.WriteLine(" VB_WinService: Service Started " & Constants.vbLf)
                objStreamWriter.Flush()
                objStreamWriter.Close()
            End If
        End Sub
        Private Sub OnTimedEvent(ByVal state As Object)
 
            Dim myLog As New EventLog
            If Not Diagnostics.EventLog.SourceExists("VBWatcher") Then
                Diagnostics.EventLog.CreateEventSource("VBWatcher", "VBWatcher Log")
            End If
            myLog.Source = "VBWatcher"
            myLog.WriteEntry("Something Happened!", EventLogEntryType.Information)
 
        End Sub
    End Class
End Namespace
 
'ServerProcessInstaller1
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Configuration.Install
Namespace mcWebService
    '    using System.Core;
 
    ''' <summary>
    '''     Summary description for ProjectInstaller.
    ''' </summary>
    <RunInstaller(True)> _
  Public Class ProjectInstaller : Inherits System.Configuration.Install.Installer
        ''' <summary>
        '''    Required designer variable.
        ''' </summary>
        Private components As System.ComponentModel.Container
        Private serviceInstaller1 As System.ServiceProcess.ServiceInstaller
        Private serviceProcessInstaller1 As System.ServiceProcess.ServiceProcessInstaller
 
        Public Sub New()
            ' This call is required by the Designer.
            InitializeComponent()
 
            ' TODO: Add any initialization after the InitComponent call
        End Sub
        Private Sub InitializeComponent()
            Me.serviceInstaller1 = New System.ServiceProcess.ServiceInstaller
            Me.serviceProcessInstaller1 = New System.ServiceProcess.ServiceProcessInstaller
            '
            'serviceInstaller1
            '
            Me.serviceInstaller1.ServiceName = "mcWinService"
            '
            'serviceProcessInstaller1
            '
            Me.serviceProcessInstaller1.Password = Nothing
            Me.serviceProcessInstaller1.Username = Nothing
            '
            'ProjectInstaller
            '
            Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.serviceProcessInstaller1, Me.serviceInstaller1})
 
        End Sub
 
        
    End Class
End NameSpace
 
I Also Have a Custome Action which run the primary output file
[+][-]01/15/09 08:56 PM, ID: 23390343Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Sharp Zaurus Operating System, Microsoft Visual Basic.Net, Web Services and WCF
Tags: Microsoft Visual Studio 2005
Sign Up Now!
Solution Provided By: Chaosian
Participating Experts: 1
Solution Grade: B
 
[+][-]01/16/09 08:45 AM, ID: 23394700Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/16/09 08:51 AM, ID: 23394769Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625