473,414 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Creating Windows Services programatically - help

Hi,

I'm trying to create a Windows service programmatically that will do the
following:

- When a user logs on, it will automatically run a service that uses BITS
(Background Intelligent Transfer Service) to check for the most current
version of a file and downloads this version.

I have a wrapper class thats imported as a reference in order for me to be
able to use BITS.

I am able to run and install the service into the SCM but when I attempt to
start the service I get the following message:

"The test service on Local Computer started and then stopped. Some services
stop automatically if they have no work to do, for example, the Performance
Logs and Alerts service."

I then see the following message logged in the Application Event viewer:

"
Service cannot be started. System.IO.FileNotFoundException: File or assembly
name Microsoft.Msdn.Samples.BITS, or one of its dependencies, was not found.

File name: "Microsoft.Msdn.Samples.BITS"

at testBits.startBits.OnStart(String[] args)

at System.ServiceProcess.ServiceBase.ServiceQueuedMai nCallback(Object state)

=== Pre-bind state information ===

LOG: DisplayName = Microsoft.Msdn.Samples.BITS, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=null

(Fully-specified)

LOG: Appbase = C:\bits\testBits\obj\Debug\

LOG: Initial PrivatePath = NULL

Calling assembly : testBits, Version=1.0.2090.30051, Culture=neutral,
PublicKeyToken=null.

===

LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).

LOG: Post-policy reference: Microsoft.Msdn.Samples.BITS, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=null

LOG: Attempting download of new URL
file:///C:/bits/testBits/obj/Debug/Microsoft.Msdn.Samples.BITS.DLL.

LOG: Attempting download of new URL
file:///C:/bits/testBits/obj/Debug/Microsoft.Msdn.Samples.BITS/Microsoft.Msdn.Samples.BITS.DLL.

LOG: Attempting download of new URL
file:///C:/bits/testBits/obj/Debug/Microsoft.Msdn.Samples.BITS.EXE.

LOG: Attempting download of new URL
file:///C:/bits/testBits/obj/Debug/Microsoft.Msdn.Samples.BITS/Microsoft.Msdn.Samples.BITS.EXE.

"

Could someone please tell me where i'm going wrong and/or what I need to
change.

Thanks.
Nov 21 '05 #1
2 1535
Amongin Ewinyu wrote:
I have a wrapper class thats imported as a reference in order for me to be
able to use BITS.

Have you tested the wrapper in a regular Windows Forms app to make sure
it works properly?
Service cannot be started. System.IO.FileNotFoundException: File or assembly
name Microsoft.Msdn.Samples.BITS, or one of its dependencies, was not found.

File name: "Microsoft.Msdn.Samples.BITS"


Is the wrapper file installed in the correct location? And are any
files it depends on also installed correctly?

Nov 21 '05 #2
Yes I have tested the wrapper in a regular Windows form app. and it works
perfectly, the problem occurs when I try and use the same code in the
OnStart method of the Service class.

The wrapper depends on on two other files and they are all stored/installed
in the same location, which is the directory of the project.
- Is this the correct location?
- Is there a particular place that I need to install the wrapper file and
its dependencies for it to work?

Also I have noticed that the wrapper class and its dependencies do not have
any public key tokens, could this be causing the error?

Thanks, Amongin

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Amongin Ewinyu wrote:
I have a wrapper class thats imported as a reference in order for me to
be
able to use BITS.


Have you tested the wrapper in a regular Windows Forms app to make sure
it works properly?
Service cannot be started. System.IO.FileNotFoundException: File or
assembly
name Microsoft.Msdn.Samples.BITS, or one of its dependencies, was not
found.

File name: "Microsoft.Msdn.Samples.BITS"


Is the wrapper file installed in the correct location? And are any
files it depends on also installed correctly?

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robert | last post by:
I get these errors when creating a asp .net web application project in VS 2003 on a remote web server: "Microsoft Development Environment The Web was created successfully, but an error occurred...
0
by: Carlos Kirkconnell | last post by:
When printing, there is a definition for a Custom paper size, the custom paper size can be setted programatically and everything is supposed to work normally. But in windows 2000 and xp, the user...
1
by: Dhans | last post by:
My requirements are, 1) To run a windows application (Which allows user to interact with that) inside a windows service. For that how do i set the service type to InteractiveMode by...
0
by: Peter D. Dunlap | last post by:
I have a number of web sites on my 2003 server, each of the independent sites (i.e., not subdirectories of the localhost site). The way I have always set these up in the past is: 1. Create a...
3
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim...
4
by: Simon Harvey | last post by:
Hi all, Can anybody tel me how to programatically kill my service when an exception occurs? Whenever something bad happens I'd like to shut it down. Also, is there a way to programatically...
2
by: =?Utf-8?B?QWxhc3RhaXIgQmVsbA==?= | last post by:
I am having trouble creating a web site on a server running sharepoint services. I am creating an ASP.Net website using Visual Studio 2005. The server I am trying to create it on is a Windows 2003...
0
by: Harry Bellafonte | last post by:
Hi I have created a Windows Sesrvice through a reg file. This is the content of the reg file: Windows Registry Editor Version 5.00 "Description"="Starts the User Process."
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.