|
Hi everybody,
i've got an problem by starting an windows service on a remote server. This windows service should perform a database backup (from mysql to sql server) every day at a specified time (like a scheduler). I installed the service using installutil which is defined as local service with an automatically startup property. but every time i try to start this service manually the following error occurred:
Error 1053: The service did not respond to the start or control request in a timely fashion
I searched through the internet using msdn aso. but I only read about a bug in .NET Framework 1.0. I use .NET Framework 2 SP2 and also VS2008. Are there any problems if .NET Framework 3.5 is also installed?
Thx!!!
|
|
|
|
|
I am trying to develop a custom camera control, to use in my application. I access the camera with the SHCameraCapture api, however, this seems to give access to other functions within this dialog that I don't want the potential user to have access to, for example, changing the image resolution, saving the image to a location and sending via an SMS etc.
What I am after is a way to lock out all the other stuff that the camera api has, so that all the user can do is have access to 3 buttons, 'take picture', 'cancel' & 'ok'. How do I do this please, I have scoured the internet and all I can find is that there maybe a possibility to do it by having a C++ library using DirectShow within my C# application, which is most undesirable.
|
|
|
|
|
I take it the SHCamreaCapture API is not open source so you cant edit the source code yourself.
this [^]may help, there is some example code if you read down a bit
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I am capturing an image from a Windows Mobile device with a camera on the back. I'm not sure how closely this is to capturing a webcam stream, not entirely sure about this.
SHCameraCapture is native code, which I haven't yet found a way to edit it's code. It is derived from the Aygshell.dll library.
Can the code on that thread be modified to make use of an in built camera on a mobile device, or is there anyway to 're-write' the SHCameraCapture code?
|
|
|
|
|
Hi,
I have windows app that uploads multiple files from a folder into the database. it takes a few seconds to upload all the files. what I need to do is to display a progress bar for the users to see that the application is still busy uploading the files to the database. I don't know how to do that in C# using Progress Bar control.
Please, can you help or advice on what to do.
Thanks.
|
|
|
|
|
Drop a progress bar on to the form. You can upate the value to indicate the percentage progress, or set the style to Marquee if it's not possible to quantify the progress.
If you wish to do the actual work on a background thread - I have a progressbar and backgroundworker combined here[^].
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Nopo wrote: don't know how to do that in C# using Progress Bar control.
You can use BackGroundWorker r in C#
Sample Ref 1[^]
Sample Ref 2[^]
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Create a background worker in your application.
It has three events that you will want to handle.
.DoWork:
put you code that does the upload file here, at the end of each file report the progress as a percentage ( 100 / totalNumFiles * numFilesUploaded), this is done via BackgroundWorker1.ReportProgress()
.ProgressChanged:
update your progress bar value with the percentage passed as in the event args i.e. ProgressBar1.Value = e.ProgressPercentage
.WorkerComplete:
notify the user that the uploading has been complete or whatever you do after its finished.
Once you have coded these event handlers you can start the upload with BackgroundWorker1.RunWorkerAsync();
As this will start a new thread you will need to pass any data that your uploading code may need as parameters to the above function
i.e
string[] filepaths = {"file1", "file2"};
string destinationPath = "destination path";
BackgroundWorker1.RunWorkerAsync(new object[]{filepaths, destinationPath});
then at the start of your .DoWork event handler you can aquire these value with the following code:
object[] args = (object[])e.Argument;
string[] filepaths = (string[])args[0];
string destinationPath = (string)args[1];
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
i have a windows service and when any exceptions occur then its stopping... is there any way to restart that service automatically when it is stopped...
|
|
|
|
|
|
thans for that.. but is the code in the
public override onstop()
{
//progie code
}
will this function execute when the service is stopped due to abnormal execution such as exception....
|
|
|
|
|
It is unlikely that any event will fire when you get an exception. Your best bet would be to handle an errors and exceptions so your service does not crash. I dont really want to suggest putting the whole service in one try/catch block and doing some restarting code in that but its your choice what approach you take
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
ok... if you are free can u tell will the service crash when the exception eccurs in the service...and i am sending the data from systems on the network to the service. and when the number of clients get more i get the exception "The IAsyncResult object was not returned" at the client side and insted of client crashing my service crashes....can i get some help with this...
|
|
|
|
|
Im afraid i can not give you any detailed help on this subject but it appears that you have a problem handling your connections in your service. the service should ideally receive a request for a connection, check anything that may stop it using a new connection, and then report back to the client with a success/fail message in regards to the connection request.
EDIT:
max.4u wrote: will the service crash when the exception eccurs in the service...
Yes the service will crash just like any application would if an unhandled exception is thrown
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
its ok... i wil once again review my code in the service... and do u know whats the maximum number of connections the tcp listener can handle without queing....?
|
|
|
|
|
It appears to vary based on the OS, i just had a quick look at this[^]
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
thanks... and if i am not bothering you.... when i create a tcp socket and connect to the server and when the connection is established then is it regarded as the tcp connection or a socket connection..?
|
|
|
|
|
Im not sure but i would say it would be both
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi all,
How to write a xml file into Remote URL using its NetWorkCredentials(userid & password) ?
Please suggest me.
Thanks in advance
cheers
kvsekhar
|
|
|
|
|
So... you want to upload a file to a server? you could create an FTP for the server
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks for your suggestion.
Is it not possible using DataSet.WriteXml(url) ?
because I could able to read xml file from url by following code
XmlUrlResolver resolver = new XmlUrlResolver();<br />
NetworkCredential nc = new NetworkCredential("id", "pwd");<br />
resolver.Credentials = nc;<br />
<br />
Uri myUri = new Uri("http://domain/Assessments/Expenses.xml");<br />
Stream s = (Stream)resolver.GetEntity(myUri, null, typeof(Stream));<br />
<br />
XmlTextReader xmlTextReader = new XmlTextReader(s);<br />
<br />
XmlDataDocument xdoc1 = new XmlDataDocument();<br />
xdoc1.DataSet.ReadXml(xmlTextReader, XmlReadMode.Auto);<br />
<br />
DataSet ds = xdoc1.DataSet;
How this logic will be applied for Writing XML to URL ?
|
|
|
|
|
im not sure if it is possible to write to a file like you are suggesting, and if it was possible it would more than likely require permissions to be set on the server for that kind of write access.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
I'm trying to copy a URL to clipboard by using following code
Clipboard.SetText("http://somewhere.com" ,TextDataFormat.Html );
But nothing comes out, essentially i want to copy a URL and when i paste to Word or some place it should come out with Blue underlined i.e it should be a link.
Thanks in advance....
|
|
|
|
|
after a brief test it would appear that word expects a paste to be in the format of 'Text' so it will paste only the last 'Text' object on the clipboard. Setting the TextDataFormat to Html will therefore not paste into word. If you change it to text it will paste into word and word will auto handle the fact that it is a link when you hit 'enter'.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Your URL is not a HTML link. Try
Clipboard.SetText("<a href=\"http://somewhere.com\">http://somewhere.com</a>" ,TextDataFormat.Html);
|
|
|
|