|
When you create a WindowsService project the wizard generates an OnStart handler for you.
protected override void OnStart(string[] args)
Doesn't get much easier than that.
led mike
|
|
|
|
|
That's good.. but I am trying to find out how to modify the service startup to pass a command line argument, not the code in the service itself.
|
|
|
|
|
Well you select the service in the "Services" MMC Snap-in and right click, select the "Properties" menu item. In the properties dialog there is a "Start Parameters" Text Box.
led mike
|
|
|
|
|
I was typing a reply to that effect when I received your reply; the only problem with that is that the parameter is not persistent. If the service is stopped/started, the parameter is removed.
|
|
|
|
|
Well you asked for the wrong thing then didn't you? What you want is a configuration solution for a Windows Service. Try looking at this article[^]
led mike
|
|
|
|
|
I am creating my first control.
I am exposing a collection which I can edit perfectly via the property grid (We'll call this names).
Into this collection I can add Forename, Surname, Address etc.
I wish however to have another property exposed where, when the names collection has at least one member, I am able to select a default address from a drop-down populated with the contents of the 'names' collection.
I have seen examples of using GetStandardValues to return a static list of values from inside the type converter, but I cannot figure out how to reference my 'parent' object in order to iterate through the names collection and return values from that.
Many thanks in advance.
|
|
|
|
|
Hi All,
I have written a Windows application in C# running on Windows XP/2000 for .NET version 1.1 . When i execute the code, and load one of the modules for the first time, it takes around 3 sec.
After unloading, when the same module is reloaded with all the same parameters, it takes only about 1 sec. All the conditions to reload the module are the same, all the SP's called are the same, which i cross verified by the ANTS performance profiler!!! But still there is considerable time difference!!!
I thought that this difference was because of the JIT compilation which CLR does for the first time and for the successive times, JIT doesnt come into the picture, hence the time difference.
But I tried generating the Native images (pre-compile the code) of the complete code using "ngen", and after observation, concluded that the behavior still pertained.
I am now unable to locate the problem as in why the time difference exists?
1. Is it that im using "ngen" wrongly?
2. Is there some other reason for the strange behavior?
I would be extremely thankful on receiving valuable inputs from the forum,
Rajesh
|
|
|
|
|
RajeshGuptha wrote: 2. Is there some other reason for the strange behavior?
The hardware and OS caching of the files that are loaded into memory? You should see the same sort of difference with a native EXE.
led mike
|
|
|
|
|
Hi Led Mike,
Sorry i could not understand the comparison you are trying to mention here...If you dont mind could you please elaborate on that??
Regads,
Rajesh
|
|
|
|
|
|
Hi Led Mike,
Thanks for the guidance,
Ill read the article, and get back if needed.
Cheers,
Rajesh
|
|
|
|
|
For one thing, there is the file system's cache; whatever file is read, it ends up in this
cache (its size could be something like 25% of your total memory, which can well be bigger
than your application's exe file) so later executions of that exe (or its dlls) may be
faster.
Second, there are the security checks (of which I dont know any details); they may
execute a lot faster second time around, probably also due to some caching.
Third, Visual seems to require a few seconds when your application throws its very first
exception (I dont know why this is), so be careful about any debugging/observation tool
that is active during your tests.
Further concerns:
- is your exe very big ?
- are there many many other files required (dlls, ....) ?
- do they all reside on local disks ?
- is any networking involved (which typically contains rather big timeouts) ?
Finally, I would not suspect the JIT, I never had to really wait for it.
Hope this helps.
Luc Pattyn
|
|
|
|
|
Hi Luc Pattyn,
Thanks for your valuable inputs..
While testing, none of the debugging tools were active.. i had ran the .exe of my application.
My exe is not that big, though it requires around 20 dlls (20 projects in Visual Studio), one among them is really huge around 20MB, as it contains hundreds of images required by the application, and 4 COM components registered locally... Do you think this is a large number? And yes all these DLLs reside on local disks. If this is a large number, then should i think of redistributing code and reduce the number of DLLs??
I connect to DB on network, do you think this might create problems only for the first time?
And for the remaining probabilities you said, is there a work around for those problems?? Have you come across situations like these???
I would be very thankful in getting further inputs from you,
Regards,
Rajesh
|
|
|
|
|
Hi Rajesh,
well I never did a 20 DLL project, so I cant tell you that is the culprit. And I sure
would hope it is not, since DLLs are needed for component based development...
But I suspect one of these two:
- connecting to the DB could be the culprit; you might modify some code
and try a run without DB (i.e. fake some data locally and watch the start-up speed).
- Assuming you are starting your app (including loading images, and connecting to the DB)
all sequentially, you could try to do (large parts of) the initialization asynchronously
and in parallel, using a few separate threads.
If this does not help, I would start looking to the DLLs.
A possible experiment there is replace the big images DLL by something much smaller.
For all of the above:
- either keep the code as is, but include some logging
a couple of lines such as
Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff")+" Starting/ending operation 3");
could reveal the bottleneck(s)
- or change the functionality of the code, but dont spend the time to modify everything
thoroughly (until you know for sure it needs the change), change just enough to be able
to judge start-up speed differences.
Regards,
Luc Pattyn
|
|
|
|
|
Hi Luc Pattyn,
Thanks a lot for your guidance.
Ill try all the possibilities, and read the articles which you have suggested. Hope to get some positive results..
Will get back to you!
Thanks and Regards,
Rajesh
|
|
|
|
|
FYI I just rediscovered an MSDN article that might interest you:
Improving Application Startup Time[^]
but be warned most of its suggestions fall in the category: "if you like some feature
because it is fancy, useful, powerful, you may not like its performance consequences."
Luc Pattyn
|
|
|
|
|
All,
Apologies if posting in the wrong forum, I wasn't really sure where to put this.
I want to create an application which can do the following:
Display a map (I'm not yet sure the format the map will be in)
Be able to pan and perhaps zoom around the map
Overlay geographic features onto the map (places of interest for example - pubs/hotels etc)
Be able to detect clicks on said features
I have tried to find a free GIS library to enable me to do some of these thnigs, but have thus far had no joy, only being able to find expensive libraries.
Thanks for your time
Jim
|
|
|
|
|
You could search codeplex for "GIS". I'm sure I saw some open source GIS libraries for .NET there.
|
|
|
|
|
|
That's great, thank you both. I had actually already come across SharpMap but thought that the LGPL license would too far restrict my use, as I am looking to have a GIS component in my application and then sell it to a client. According to the FAQ ( http://www.codeplex.com/SharpMap/Wiki/View.aspx?title=Is%20SharpMap%20free%20with%20no%20strings%20attached ) this doesn't seem possible, but perhaps I have misread?
Can anybody shed any light on this for me? If I have an application which uses the library am I able to sell this for a fee?
Thanks again
Jim
|
|
|
|
|
Hi All,
I'm currently working with Visual Studio 6.0 VB and C++, now I want to migrate to .NET platform, witch language should I choose ?
Any ideas, thanks
Carlos Mariano
|
|
|
|
|
Use C++/CLI and/or VB.NET 2005 =)
ROFLOLMFAO
|
|
|
|
|
Well C++ is still viable and as Scene states there is C++/CLI for doing Managed or even Mixed Mode development. If at all possible I recommend dropping VB altogether and moving to C#.
led mike
|
|
|
|
|
You want to keep as much as possible what you already have and know ? Stick to your familiar
language, inside .NET
You want to move forward ? Go for C#.
It may look a bit strange and complex at first (events, delegates, generics,...),
but you soon will appreciate its expressive power.
Luc Pattyn
|
|
|
|
|
If you're either more comfortable with C++ than VB or equally comfortable, then go for C#.
Kevin
|
|
|
|