|
|
Hi,
I see that names are not consistent:
System.Diagnostics.EventLog.CreateEventSource("MySource", "MyNewLog");
but next line says:
eventLog1.Source = "MyEventLogSource";
probably it should be
eventLog1.Source = "MySource";
if it still does not work,
can also be Logon As permission of the service
(seen via Control Panel ... in service properties on the 2nd tab)
Cheers,
|
|
|
|
|
 I completely removed the eventlog code but still having the same problem!
here is the code after modification:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Net.Mail;
namespace MyTestWindowsService
{
public partial class MyTestWindowsService : ServiceBase
{
public MyTestWindowsService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
protected override void OnContinue()
{
}
private void timer1_Tick(object sender, EventArgs e)
{
}
private void timer2_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (DateTime.Now.Minute == 30)
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("it@mydomain.com");
mail.To.Add("jassim@mydomain.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("it@mydomain.com", "mypassword");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
catch (Exception ex)
{
}
}
}
}
}
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: the same problem
Which "same problem" are you talking about? I see several problem with this code.
Your service is started, OnStart is called, seeing that there is nothing in your OnStart method, nothing happens, the method exits, your service exits.
You do not have a timer 1 to use the tick event handler you have setup
You do not have a timer 2 to use the tick event handler you have setup
You would need to set the UseDefaultCredentials property to false
You probably don't have access to network resources depending on the user account your service is running under.
You can lead a developer to CodeProject, but you can't make them think.
The Theory of Gravity was invented for the sole purpose of distracting you from investigating the scientific fact that the Earth sucks.
|
|
|
|
|
Create your event source at install time, not when the service is executed. This is easily done with a couple of registry entries in your installer. See this[^].
|
|
|
|
|
Where do you create / start your "timer"?
|
|
|
|
|
Hi,
I have a C# .NET software and I would like to deploy it with protection. I though many times of the [Product Key] which will be generated from a mix of hardware serials but I saw some applications such as Micros POS using the USB Dongle Protection.
Which one you recommend?
Thanks
Technology News @ www.JassimRahma.com
|
|
|
|
|
I'd recommend you don't spend too much time or money on it...
You have to balance the number of lost sales against the cost of the protection. How much does a lost sale cost you (if the product is pirated by someone who would otherwise have bought it) compared with an hour of your time? If you are low volume or low cost, it doesn't take much before it costs you more to implement the protection than you save in lost sales.
And how good is the protection going to be? If your software is really popular (or really expensive), then hackers will get round the protection anyway: look at Photoshop. Adobe have a large team, and invest a lot of money in protecting the product. But...there is a "cracked" version on the torrents pretty much the same day a new version is released.
And if you make the protection too draconian, you will start to annoy people who have bought the product, and it doesn't take many of them to demand their money back before you get a bad reputation and nobody buys it anyway.
And dongles are physical objects: you have to ship them, which means holding them in stock (and paying in advance) - and that means no download model for distribution.
I'd look at an online verification every time you start up the app or similar, nothing much more complex - I'd not bother with dongles. But even then, you need to let the user know that is going to be required before he buys it. From a user POV there is nothing more annoying than finding out afterwards, when you have no signal!
You looking for sympathy?
You'll find it in the dictionary, between sympathomimetic and sympatric
(Page 1788, if it helps)
|
|
|
|
|
The Dongle.
If you base it on serial-numbers, then you're going to piss of both the users and the people who have to provide support. Why? Because every time there's a new harddrive or whatever, the key "appears" invalid. If that is interrupting the user while he needs your app, then pissed it is.
And no, there's no 100% protection either way. Lots of software-based copy-protections can be easily mitigated by installing in a VM with generic hardware. The dongle OTOH is quite hard to circumvent.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I agree with change hardware part
but what's the best way to do it.
My application is a database client-server software. I thought of putting some verification code in the database and let a service running on the server to check it
but the I asked myself, what if someone purposely stopped the service?!
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: but what's the best way to do it. That will depend on how much safety you realistically need, what you want to invest, and what the customer will allow.
Life can be good if you physically "own" the server. Lock it in a box, add a seal, done.
If the server-software is running on hardware that you do not control, than a dongle would be a good idea. The clients might not need one. Not only does that cut some cost and some mucking with keys, but also makes support a bit easier. If the servers' webservice is blocked, then the client should simply refuse to work. If someone sabotages the things that the software needs, simply exit the app - a client is kinda useless without a server. As long as the server is secure, all is well.
Ultimately, having dongles on the clients gives you some more control over how much of those are out there. We used a HASP 4[^], later seen Hardlock in use at another company. I've tested it for a day, downloading all kind of "hacks" claiming to be able to break it. Didn't work then, and seems the dongles have even learned some new tricks by now.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
but with dongle, there is still a major problem!
The dongle will be installed on every client not the server because the server is just hosting the database so if I have 10 clients then I'll need 10 dongles!
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: so if I have 10 clients then I'll need 10 dongles! Yup. If you want a dongle for each client, you'll need lots.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
and if I want it just for the server?
Technology News @ www.JassimRahma.com
|
|
|
|
|
That would be cheaper, without adding much risk.
See, most client-software is useless without the server, and you wouldn't be hurting much if someone is using two unregistered clients within his/her network. If someone can actually copy the server, then they can duplicate the entire thing on a different network.
If the authentication webservice to the client is blocked, put up a message to call "support".
The main question to answer would be this; do you expect that piracy is going to cost you MORE than the dongle costs? If the answer is "no", then having one on the server might be enough (at least, for the time being).
If you can, then scout some pirating-sites to see if your software is mentioned. If it is, then upload a big pile of nonsense-data that "claims" to be a pirated version of your software. And then delete Part11.rar
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
And if the server is running on a Virtual Machine? Can you be sure that your dongle can somehow be "forwarded" from the host (i.e. the real hardware) to the Virtual Machine?
|
|
|
|
|
..I'm not selling the thing, so I should not need to defend the technology. The VM did not have any problems with it. And no, I would not expect a problem there - but rather on a virtualized app, like most Citrix environments.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: then you're going to piss of both the users and the people who have to provide support
Of course the same happens if they lose the dongle and then you tell them they have to buy the software again.
|
|
|
|
|
jschell wrote: Of course the same happens if they lose the dongle and then you tell them they
have to buy the software again. If it's a registered user, you could provide one at the price that the dongle-maker asks
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello,
I have some issues with the understanding of how it is possible to use a the 128 bit Decimal Type on my 64 bit computer. Somehow the logic doesn't seem to come to me. Can someone please explain how this is possible? Thank You.
|
|
|
|
|
|
How do you think 8 bit processors handled 16 bit integers?
It's not difficult: you just have a half carry in the middle!
0x1234 + 0x6743
is worked out in 8 bits as:
0x34 + 0x43 == 0x77 plus a zero carry
and 0x12 + 0x67 + 0 == 0x79
== 0x7977
It's not done quite that way with decimals (because floating point arithmetic is a lot more complex) but that's the general idea.
Think about it: you are a base ten processor: but there is no limit on how big a pair of numbers you can do arithmetic with!
You looking for sympathy?
You'll find it in the dictionary, between sympathomimetic and sympatric
(Page 1788, if it helps)
|
|
|
|
|
You had me at
OriginalGriff wrote: how big a pair
|
|
|
|
|
Clubs?
Spades?
:InnocentWhistleSmiley:
You looking for sympathy?
You'll find it in the dictionary, between sympathomimetic and sympatric
(Page 1788, if it helps)
|
|
|
|
|
At clubs usually. As for the other, I hesitate to use such language.
|
|
|
|