Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have a C# service that requires to write a certain text to a SQL Server database before shutting down after OS restart. So the service MSSQL$SQLEXPRESS should not stop before my service and in order to achieve this, I have added a dependency of MSSQL$SQLEXPRESS using the command
sc.exe config MyService depend= MSSQL$SQLEXPRESS
However, it does not seem to work as I am still getting error
SHUTDOWN is in progress.
Login failed for user 'user'.
Cannot continue the execution because the session is in the kill state
when trying to write to the database in OnShutdown(). Sometimes the error is an "invalid handle" error..
What am I missing? Also, sc.exe qc MyService shows the dependency, but dependencies under services.msc shows nothing. Why?
From the docs:
Note that during service shutdown, by default, the SCM does not take
dependencies into consideration. The SCM enumerates the list of
running services and sends the SERVICE_CONTROL_SHUTDOWN command.
Therefore, a service may fail because another service it depends on
has already stopped.
To set the shutdown order of services manually, create a multistring
registry value that contains the service names in the order in which
they should be shut down and assign it to the Control key's
PreshutdownOrder value, as follows:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PreshutdownOrder="Shutdown Order"
Service Control Handler Function
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I have a Windows service running on Azure VM. The service constantly accesses KeyVaults and Web APIs to run some tasks.
The logs in my service show this message sometimes while accessing keyvault. Most of the times service can access keyvault, but sometimes I get this error:
System.Net.WebException: The remote name could not be resolved:
'keyvault.vault.azure.net'.
When I connect to VM through RDP, sometimes I get disconnected with the following message and immediately connects after few seconds.
But when I see System Logs in Control panel, it shows no error message at that time.
I also have another issue while making an HTTP request to Web API as explained in this question.
So my question is, can all these be related to one another? Is it possible that VM is getting disconnected very often from the network and due to this, all the above-mentioned things are happening? How can I test and conclude this?
The times i have seen issue like this it is due to OS performance issue. It could be memory, CPU or even network throttling but almost certain performance issue.
Make sure the VM sku you are on is able to handle application performance.
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/sizes
Hope this helps.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
We are seeing an issue with a WPF application that opens a WCF service that listens to accept data on a port. We had a shortcut that would automatically start this WPF on startup and it worked fine, but we have started restarting the PC through RDP and now when the computer restarts, we get a TCP error in the WPF "The Requested address is not valid in its context" while listening on the correct IP. When we close out of the app and open it back up, it works fine. Is it possible that when we restart without closing this application, it does not quit this connection so on startup when it tries to open this application and start a new service, there is a conflict? I'm new to WCF services and don't know a lot about the inner workings like this, but it seems to me like when we get this error then close out the app we are correctly shutting down this service as well so there is no conflict when we start again.
EDIT: The answer was that networking was not up yet when the app was started. We added a 10 second delay in the batch file to allow for networking to start before running the app:
choice /C X /T 10 /D X > nul
With each new Windows version the user can earlier interact with his session but not everything has completely started up. That makes you feel the new system is much more faster than the old as it really is.
Applications that will run on session startup will have to deal with that when the session starts right after a system restart.
So check the system state before starting the service or just retry starting the service until it gets up.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I wrote a small program for downloading files for my client.
The program uses HttpWebRequest to send a POST request and a GET request.
I tested the program on my laptop and on my manager's desktop and it worked well.
However, when I deployed the program to my client's desktop, it gave me this error:
"System.Net.WebException: The Operation has timed out."
What might be the possible reasons for this?
The deployment was very simple, I just changed the App.config to set the target folder's path.
My client's desktop is a server. Is it possible that firewall blocked my request?
But I was able to accomplish the downloading process through browser on my client's desktop.
Please give me some suggestions if you have related experience.
Thanks
Firewall, Antivirus and insufficient timeout are very possible reasons (in my experience).
Probably the windows firewall is blocking your application from connecting to the server. Try to add an exception for your app by running wf.msc. You will need to add an outbound rule.
In order to test quickly whether this is the real reason for your problem, you can try to disable the firewall completely for a short time if it isn't a big security risk.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have an automated UI test written in C# (using MSTest) that runs on a remote virtual machine. Parts of this test utilize the user32.dll mouse_event method in order to click certain areas of the screen that are not otherwise interactive.
This test works fine when I run it locally, and also when I run it remotely with the agent computer being remotely connected to (via the MSTSC console). The problem is that whenever I completely minimize the MSTSC console (or altogether close it), the mouse actions are not being performed as they should be, and my test fails.
It should be noted that the remote computer runs Caffeine which prevents it from logging off or activating a screensaver - so the tests should run as usual (and the parts that do not involve mouse indeed work just fine).
I reckon this issue has something to do with the mouse being offscreen -- has anyone encountered a similar issue and could offer some help? Thanks.
It seems that the problem is due to RDP's default behavior, which locks the remote computer when the remote window is minimized.
I have managed to override this behavior by following the steps described below -- unfortunately this requires modifying the registry on the computer running the MSTSC console. Also, it is not possible to terminate the remote session, otherwise input is again disabled (and I haven't found a documented way to override it as of yet).
To allow remote desktop to be minimized:
Open regedit and navigate to the key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and value 2.
On 64-bit OS's, repeat this for the registry key: HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client as well
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have implemented a simple HTTP Server using HTTPListener , I need to launch a process that runs for about 10 minutes from HTTPListerner . When a request is made from user , I dont want user to wait in browser untill the process completes as its going to timeout . So I launch process and just return a status . How can I launch the process ?
Process.Start
also take a look at the options when starting a process
In my opinion you should:
Receive the request and assign a unique ID to it
Launch the process
Send back the unique ID to the user
Allow the user to get back the status of your processing using your ID
It's your choice (it depends on your app) if these IDs are stored in memory or on a file/database.
Consider, as an addition, that if this simple HTTP Server is hosted on IIS, that IIS has the opportunity to kill your process as soon as is necessary, so it's not a good idea to start long running processes.
You should take the request with your HTTP server, but then start the process from a backend service.