|
That's a very generic error message for any service that can't start. I recommend you set the AutoLog property to true and check the event log (eventvwr.exe) for more detailed information.
It may be that you're using functionality only supported in XP and newer, but without more information it is impossible to determine.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
AutoLog is set to true. Another message that I get from EventViewer is "Timeout (3000 ms) waiting for the service to connect".
I do not use any XP specific function. In fact, my OnStart() and OnStop() are empty.
Thanks for your response.
|
|
|
|
|
You might explain what your service does, then. Like I said - any service (native, .NET, VB, whatever) will report that (it's actually the service control manager (SCM)) when any error occurs. It expects that the service itself will report additional information in the event viewer (like it should).
If you link against other assemblies (besides the .NET BCL assemblies), make sure they are in the same path, in the GAC, or in a path configured in your service's .config file. Read How the Runtime Locates Assemblies[^] in the .NET Framework SDK for more information about how assemblies are located.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Just be clear, I am talking about "Windows service" not "web service."
|
|
|
|
|
Web.config is what ASP.NET uses. Windows applications that are launched by the executable loader use the "appname.exe.config" file-naming convention. It's all about what sets up the default AppDomain, loads the AppDomainSetup , and loads and executes the target assembly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can anyone tell me how to perform a hit test on a GDI Region from a mouse point ?
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[DllImport("gdi32.dll")]
static extern bool RectInRegion(IntPtr hrgn, ref RECT lprc);
Just convert your point to a RECT first.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Just in case you're using .NET's GDI+
(assuming you have a Region r)
<br />
bool hit = r.IsVisible(new Point(x, y))<br />
Just look up the IsVisible(...) method on MSDN.
|
|
|
|
|
I am developing a program to sign documents with it. When the document is going to be signed, I have to select a certificate, but, where is the private key associated?
Also I would like to know if it is possible to download a Certificate Authority to install in my PC to make testings (I have Win 2000 Proffessional, I know that there is one in Server edition but my PC is not powerful enough...).
Thank you for the information.
-.Rodrigo.-
|
|
|
|
|
Did you take a look at my article at http://www.codeproject.com/dotnet/xmldsiglic.asp[^]? It discusses this a little.
The private key is acquired from a CSP as I mentioned earlier (I believe you were the same person, only anonymously). The CSP is encapsulated in various CSP classes in the .NET BCL but how you access that key isn't always the same. To access the key in my article, for example, I had to use the key at index 1 (0-based, IIRC) because index 0 were keys used only for exchange data. If you could describe a little more about what you're doing, we might be able to help a little more.
If you need to create a self-signing CA, I suggest you download OpenSSL[^]. I wrote an article a while back using a custom configuration file, but when the old site upgraded the downloads were lost and I no longer have the ZIP that contains the config. You can construct one using OpenSSL's default configuration, however, along with their instructions. Just be sure to create a CA that can sign for different capabilities (like server authentication, client authentication, software signing, or whatever you need - or just all capabilities to make it easier).
It's really not too difficult if you read the README file, and I actually think it's a little easier once you get the hang of it than Windows CA Server (which is tightly coupled with the domain).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have the following code:
/* In myprog.exe - I get an exception here */
catch (LdapException e)
{
string port = String.Format("{0}", ldapPort);
m_log.LogMessage("strCantConnectToLdap", "strCantConnectToLdapTitle", e, ldapHost, port, loginDN);
return false;
}
/* which calls this in my.dll */
public DialogResult LogMessage(string headerTag, string messageTag, LdapException e, string sub1, string sub2, string sub3)
{
string [] subParams = new string[3];
subParams[0] = sub1;
subParams[1] = sub2;
subParams[2] = sub3;
return FullLogMessage(headerTag, messageTag, MigError.ErrorLevelE.ERROR, e, subParams);
}
/*which call this in my.dll */
public DialogResult FullLogMessage(string messageTag, string headerTag, MigError.ErrorLevelE level, Exception exception, string [] subParams)
{
// Rework for different types of exceptions
if (exception != null)
{
if (exception is LdapException) /* should succeed but doesn't - why?*? */
{
LdapException e = exception as LdapException;
format = LoadString("strLdapExceptionFormat");
string ldapErrorString = MapLdapError(e.ResultCode);
exceptionMessage = String.Format(format, e.LdapErrorMessage, e.resultCodeToString(), ldapErrorString, e.StackTrace);
}
else
... <falls through="" to="" here="" instead="" why??? ="">
}
}
Any ideas?
BRCKCC
|
|
|
|
|
hello,
I am trying to sign data with a CAPICOM.SignedData object.
The SignedData object has got a method called Sign() which performs the operation and this method has got a parameter called Signer which (according to the CAPICOM reference) "must have access to the private key of the certificate used to sign".
I had understood that a public key certificate contains the subject's public key. so, I think that "the private key of the certificate used to sign" means that the certificate does not contain the subject's private key but that is associated with it. My questions are:
1. how is this association?
2. where is stored the private key?
3. how can I obtain a signing private key?
thanks in advance
|
|
|
|
|
Don't use CAPICOM (an interop library). Almost all the functionality of the CryptoAPI is encapsulates in the System.Security.Cryptography namespace and child namespaces and is written to support .NET while using the CAPICOM requires marshalling and isn't always .NET-friendly.
When you sign data, you sign with your private key. This allows the recipient(s) to verify your signature (an encrypted digest of the clear-text, typically) using your public key. RSA uses the same signature and encryption algorithms, where DSA uses different algorithms (more secure).
The private key is maintained soley by the user. It should never be uploaded to a PKI server or be available for others. That would defeat the whole purpose of public key encryption. Only the public key is made public, hence the name.
If you're trying to access your private key, you must provide CSP (cryptographic service provider) information to use a CSP (software-based, smart card, etc.) that contains a private key, as well as how to access that private key.
If you want, see my list of articles (link to them in my sig) for the XML Digital Signatures article. That contains information about using XML signatures and the SignedXml and SignedInfo classes to access your private key in a software-based provider (used by the sn.exe .NET Framework utility app) using the right index into the right key provider.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thank you, Heath.
if i dont use CAPICOM, how can i create a CMS/PKCS#7 (SignedData) structure? I think there is not a PKCS#7 structure in the .NET class library.
ahhh! I think that the response to my question (how is the association between a public-key certificate and the signing private key) was the PKCS#12 structure, wasn't it?
thanks.
|
|
|
|
|
Yes. IIRC, the PKCS12 structure can store more information, but I really haven't worked too much with such types of storage structures. Most references to such structures I see are typically PKCS12, however.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello all,
I currently have a Hashtable that contains a string key and an int value, I am then using this hashtable to populate a combo box using the int value as the combos display value and the key as the combos real value.
The problem I have is that my hashtable values are all ints and I would like this to appear in descending numerical order in the combo.
It seems that the Hashtable does perform some sort of low level ordering as the items do not enumerate out in the same order they were placed into the hashtable. I have tried using sortedlists but the sorting is performed on a string basis, so you end up with something like :
1
11
12
123
1384
22
26
2984
3
I need to use a these types of collections as parts of my code are highly dependant on the .ContainsKey(...) function and the object["keyname"] functionality which is not available on, say, arraylists of simple object arrays.
After spending sometime with google I have had a look at NameObjectCollectionBase and the cp article http://www.codeproject.com/csharp/hashlistarticle.asp[^] but they both seem a little too much for seems like a simple problem
So the question is how can I generate a numerically ordered collection and have the functionality of a Hashtable?
After spending
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
You pass an IComparer implementation to either the constructor for a list, collection, or dictionary (for those that have such a constructor), or assign it to any supported properties. The Hashtable lets you pass an IComparer implementation to the constructor and allows derivative classes to assign the comparer field.
Read the .NET Framework SDK documentation for the IComparer interface about how the implement it and to see an example (though it's honestly not that hard).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
What you want is a dictionary whose internal structure orders the items by value. The Hashtable performs no ordering. The SortedList performs key ordering. The HashList that was created in the article you referenced performs temporal ordering so it wouldn't help you either. There is no primitive data structure that satisfies this requirement so you'll have to create your own that internally uses both a hashtable and some type of key ordered dictionary for storage. Using both data structures together will give you the ability to order your custom dictionary by value.
When you say that you need to have the functionality of a hashtable did you really mean that a dictionary is sufficient? The reason I ask is because the hashtable is distinquished from other dictionaries because it has O(1) inserts, deletes, and searches. It is impossible to create such a dictionary that is ordered and still performs like a hashtable. If you want your collection ordered by value and to behave like a hashtable then you're out of luck, but to make it behave like a dictionary in general is easy.
I can post an example of this if necessary. But right now it is time to go home!
|
|
|
|
|
Hey,
Today i started working with databases in C#. For the app i'm making i use a premade Access DB. (with tables etc. in it already) With Visual C# 2005 beta i can easaly connect the database to a datagrid. That part works great. But now i want to write new values to the database via input fields. I searched all over the internet to find a good article about it, but i cant find anything usefull Can somebody maybe help me a little?
ps, sorry for my bad english
|
|
|
|
|
|
Thanks for the quick replay
|
|
|
|
|
I'm using a FolderBrowserDialog, which seems to be crashing on full path names with lengths 133 or greater.
I've written a test app that only has a Browse button and a label to display the length of the selected path.
The results are erratic.
With paths of of length 132 characters or less it seems to work ok (i have seen it crash once on 132-length path, though).
At 133, it works sometimes and sometimes not.
At paths of 134 or greater, it crashes almost every single time. Sometimes when you hit the "OK" button in the dialog, sometimes it won't crash until the next time you hit the "Browse" button, sometimes not until you try to close the program.
I have tried different paths all over my system, and 132 seems to be the magic number. Can anyone else duplicate this?
|
|
|
|
|
|
Well that answers that. Thanks Heath.
I'm curious what google query you used, i tried searching before i came here.
|
|
|
|
|