windows service server crashes - windows

I have created windows service via Visual Studio.
The service is running ftp server.
I have the same program in .exe app which works perfectly fine.
However, the service crashes in after a while.
I doesn't even get into the OnStop/OnShutdown event, just stops working.
Any ideas?

After doing this myself recently, here is a way of making sure the service restarts after its own crash:
Go to Start - > Control Panel and select Administrative tools in the window. Then, select services and right click on the service you'd like to customize. Under the recovery tab you can set the first failure to restart the service, along with the second and subsequent failures. I hope this helps you out!

Related

About behavior of "Minimize" in case of Remote App when using Guacamole

We are using Guacamole for developing an application with RDP. We did POC using code from the following GitHub repositories:
https://github.com/wwt/guac
https://github.com/wwt/guac-vue
Configuration details are:
Windows Server 2016. RDP service is running here.
With this setup, we could successfully access the application remotely, however, the "minimize" action is not behaving as we expected. That is, the remote app window vanishes when we press the "minimize" button and a black screen is shown.
We could get back to the app by pressing 'Alt+Tab' combination but what we are expecting here is that the app getting placed at the bottom of the window showing three buttons: "Minimize, Restore and Close", so that we can take the further action. (As shown below.)
Has someone come across such a scenario and was able to address the need? Any help will be highly appreciated.
We came across this thread that talks about a similar problem but it doesn't have a solution.
We also explored official documentation of guacamole but had no luck.
Thanks in advance!
I believe you are starting the application using RemoteApp mechanism. The RemoteApp means that the remote application will be started integrated with the local computer desktop. The local computer desktop, or better window manager, will handle the minimise action.
In case of the Guacamole, the "local computer desktop" is the browser window, which does not have window manager. This means that there is no place for app to go when minimised.
You may try the Guacamole parameter "initial-program" instead of "remote-app". This parameter will launch the application immediately upon the connection is established, but the session will also have full desktop from the remote machine.

Audio Service Not Starting/Functioning Properly

My Audio Service refuses to function properly. I have tried so many different solutions I can't even recall all of them.
Here's how it started; I got home from work one day to see my computer has no video signal but is turned on and receiving input from my mouse/keyboard. I force restart my computer and, after it boots up, I see that the Windows Audio Service is stopped.
I first try to use the task manager to start the service (Audiosrv) and it would blink at Starting then immediately go back to Stopped. From here I went to the Services window and tried starting it from there (Windows Audio) and, after trying to start, says Access Denied (Error 0x80070005).
So after searching a solution I went into regedit and was told to add System as a permission group for AudioSrv and the AudioEndpointBreaker service. Turns out they were already there with FULL CONTROL for both.
I try to change the logon to use Local System Account (WITH INTERACT DESKTOP CHECKED!) and voila, my audio service is running! But my bad luck continues.
None of my speakers/headphones are creating sound even though the service turned on and I can see all my devices. As an attempt I tried to do test sound, and this error appears.
Keep in mind I've restarted after every one of these fixes, both the service and my computer afterwards. As a final attempt I tried to open the Command Prompt as administrator and entered sfc /scannow . After verifying, this message appears.
I honestly have no clue what could've happened while I was working, but I'd rather not have to reinstall my windows to lose all my files.
Recap of my attempts to solve
Start the Audiosrv service from Task Manager (failed to start but keep in mind the EndpointBreaker service was running)
Opened services window and tried starting the Windows Audio service (Access Denied [Error 0x80070005])
Tried adding System as permission group for AudioSrv and AudioEndpointBreaker to find out both already had Administrators, my user, and System with full Control.
Changed login to local system account with interact desktop control checked and it fixed! Supposedly. THIS WAS THE FIX FOR 99% OF PEOPLE ON THE FORUMS
After realizing my sound wasn't playing but my devices/control was showing up, tried testing sound and received an error.
Last resort I did a sfc /scannow command and was given the response shown above.
What should and what can I do to get my audio running?
SIDENOTE
When I drag the volume slider [which usually creates a tone with the volume adjusted], the speakers/headphones meter on the Sound window do NOT light up green (in other words they aren't showing sound receiving on its end)
I resolved this issue after doing a system restore.
Add the Local Service in the Local Users and Groups
Right-click This PC or My Computer, depending on which version of Windows you have, and select Manage from the dropdown menu.
To the right, you will see a System Tools section. Double click Local Users and Groups, and select Groups beneath it.
Right-click Administrators in the list in the middle of the window, and select Add to group.. from the dropdown menu.
Click Add, then Advanced, and then click Find Now. Double click Local Service, and click OK. You should see NT Authority\Local Service in the list, click OK. Close the Computer Management window and reboot your device. Your problem should be solved.
Then in services.msc change logon to LOCAL SYSTEM.
If you dont permission to run Windows Audio:
key windows + Services
search Windows Audio
right click settings
login
Local system account and allow the service to interact with the desktop
save and run Windows Audio

VS2013 won't debug a specific web application

I have a web application that uses IIS, but when I try to debug it VS just locks up and gives me the hour glass cursor icon. No browser window opens, nor does an instance pop up in the Task Manager. VS says its Running / not "Not Responding", but I cannot interact with the IDE. Can't Ctrl-Break to stop or anything.
I was able to run it before, and I'm not aware of any system or IIS changes that could cause this. I've disabled source control and I've tried launching the app in both Chrome and IE but it still behaves the exact same way as described above.
Has anyone else encountered this? The only threads I could find just describe general slowness in the IDE but otherwise its functional. The recommended fix was to disable the source control functionality, which as I said I already tried.
I should note that I don't seem to have an issue running & debugging winforms applications. I also just created a web application and was able to launch it in Chrome and get to the homepage. Also, it doesn't make a difference if I have a breakpoint set or not.
This solution has 4 different projects. If I set a different project as the Startup Project, it does run and launches the browser but it just gives me a 'file explorer' sort of view where it just lists the files in that project's directly which is obviously not what I want.
Edit; If I manually open a browser tab, try to navigate to http://localhost/myApplication, VS pops up and asks if I want to attach process w3wp.exe to IIS APPPOOL\myAppPool. If I attach, it opens a new tab in Chrome and my application runs. But unless I do these 2 steps, it does not run.

Android Studio starting in debug mode by default

I have been working on a project, and when I run the project in android studio it had been running correct and when I ran in debug mode it ran correctly.
All of a sudden, when I try to run the project normally, it pops up on the device waiting for debugger
and in the logcat I get this:
02-07 10:38:46.444 3968-3968/com.geog.test D/dalvikvm﹕ Late-enabling CheckJNI
02-07 10:38:46.784 3968-3968/com.geog.test W/ActivityThread﹕ Application com.geog.visitdub is waiting for the debugger on port 8100...
02-07 10:38:46.804 3968-3968/com.geog.test I/System.out﹕ Sending WAIT chunk
and it goes no further. I don't know why this is happening, there is no debug command in the manifest, I have killed the adb and restarted as I did with android studio.
It's a real pain in the a*** as I can't run the app without going through debug mode. If anyone has any ideas I'd like to hear them
Thanks
Restart your Android Device once and also check there should not be any breakpoints in your java classes.
The above suggestions were too invasive for me so I digged a little more into it. The following solution works for me in android studio:
Start debugging. (You'll get the wait chunk message here)
Select the Debug pane with the bug icon.
press the small cross at the side menu.
press "Force close" on your device.
Restart debugging.
In my case, there was an AsyncTask whose doInBackground() method called android.os.Debug.waitForDebugger(), and this was being picked up even in run mode. Disabling the line fixed it. Restarting the device didn't help.
try this , always work :
1 - close Android Studio and any other IDE you have opened (maybe you have Eclipse also running?) and emulator instances;
2 - remove USB cable from PC and restart your phone if you use one ;
3 - run adb kill-server from console;
4 - open Android Studio;
5 - click on run/debug;
6 - when the window to select the device appears, attach your device to USB and USB to your computer;
In my case it was a service to which I had added android.os.Debug.waitForDebugger(). The service was in a separate process by defining in the manifest android:process=":sepprocess"; after removing this line (such that the service is in the same process as the main activity), debugging started to work in the service and I did not experience the
I/System.out﹕ Sending WAIT chunk
anymore.
First clear all the break points from your project using ctrl+shift+F8 for windows or for mac cmd+shift+F8. Restart your android device. Then run
In my case, there are multiple debuggers. I have native code running in my app.
I cleared it by selecting the Debugger and Process from Run->Attach Debugger to Process
I deleted the emulator and recreated. It worked for me.

How to shutdown local tomcat server when closing browser window?

I hava a web app running on a local tomcat server.
When the user starts the app (via desktop shortcut) the server starts and the app is opened in a browser window.
But when the user just clicks on the close button to stop the application the server is still running in the background - that's annoying.
I tried to utilize the "unonload" and "onbeforeunload" events from javascript but unfortunately these events are also fired on some other requests in the app.
So I can't use them, except I do a lot of refactoring.
Does anyone have an idea for a possible solution?
Btw, what I find interesting is the behaviour of Visual Studio when debugging a web application. When I close the browser window Visual Studio also gets a trigger to stop debug mode. So it seems it somehow notices the close event of the browser window, which would be exactly what I need. But I don't know how they do it...
Can you wrap the starting of Tomcat and launching your app in a batch file or shell script? (Not sure what your target OS is...)
The script/batch file would start Tomcat and then launch your application. When the user exits your application, the script/batch file would then shut down Tomcat.
You can setup a short session timeout, and use a HttpSessionListener. On sessionDestroyed(..) you can stop tomcat (using catalina.bat for example) .
Otherwise you can try to detect browser close, and send a shutdown message to the server using ajax (before the browser is closed).

Resources