Open Console Application inside Unified Service Desk - console

I have a requirement where i need to open a Console Application inside Unified Service Desk v4.1.
The issue with me is I am able to open the console application inside Unified Service Desk, However I am unable to write anything inside it. The console application is just appearing as an image inside USD.
So, how can I open the console application inside Unified Service Desk and make the Console application work?

Console application is actually hosted using CCA application. The issue with these applications are once opened, then they become unresponsive.
1. Create a UII Windows Forms Adapter
2. Trigger the process and execute your console application
3. Using Win32.dll setParent Command, pull the application inside your Adapter and that would be it.
Hope this will help

Related

log4net console appender logs viewing in .net core windows service application

Have anybody used console log4net appender in .net core based windows service application?
I am using .net core 2.1.6 console application which is hosted inside windows service. I have a file appender which is righting to file. wanted a console appender log view real time at console as well.
A Windows Service has no visible console, it runs on an invisible desktop. See Console.WriteLine() inside a Windows Service?.
If you want to view your log in real-time, then open the log with a viewer that supports that, for example tail -f on Git Bash, or through Notepad++ with the tail button (eye icon). Note that the latter tends to hang of the file is being written to a lot.

Run ActiveXObject COM component that creates dialogs under IIS in Asp.NET

I have a ASP.NET MVC app, hosted on IIS on a dedicated server. At some point I need to create a com activex component. I use Interaction.CreateObject from Microsoft.VisualBasic.Interaction for this.
The issue is that this activex component shows some dialogs when starting and waits until they are closed before actually registering as COM component.
I wrote some simple code that closes the windows via Windows API using FindWindowEx etc. and it works on a dev machine when hosted under VS, but it looks like on IIS these windows are never shown even in Windows API and ActiveX component just freezes waiting for dialogs to close that never exist.
I tried:
Using Process.Start and then Interaction.GetObject instead of Interaction.CreateObject
Setting AppPool in IIS to run from a real user identity
Setting Load User Profile to True in IIS
Using https://github.com/mj1856/SimpleImpersonation library to run the code as a user
I also looked in dcomcnfg (and this is my best bet on what I need to do). I thought I need to find my COM component there, and set Identity to specific user - but for some reason the ActiveX COM component I'm running does not exist there. I see "cannot register COM component" in Event Viewer if the component run crashes by timeout (because it waits for dialogs before registering as COM), - so I know AppID, but it does not exist in the list in dcomcnfg. Maybe because the ActiveX is exe, not ocx?
I know IIS is not supposed to run anything with windows, and it of course cannot show them, but I was at least expecting to see them with Windows API and being able to close them, especially given that the component waits for them to be closed, so they exist somewhere. I think I'm missing some clever setup on the server.

IIS open file on Active User's Desktop

Here is situation:
I have a large collection of videos on a computer, and it will be hooked up to my TV. I would like to make an app to open my videos on my computer from my mobile device (Yes, I know it exists, I am just working on it for fun)
So I have setup a web service, and an app to consume said webservice. The webservice gathers a list of folders/files, and sends them to my device as well as can take in a file path and open it with the default program using System.Diagnostics.Process.Start(path)
When I am using IISExpress, it works fine, but I would like to use IIS. When I use IIS, I open the video file and hear it playing in the background, but it doesn't show up on the monitor. VLC appears in the task manager, and when I kill it, the sound stops.
I'm assuming the issue is the identity under which the app pool is being run, but when I tried to change the identity, it didn't make any difference. If it helps, I am running Windows 8. Does anybody have any thoughts on how I can make the app pool run under my identity, or open the process on the desktop of the active user, rather than open it under the app pool's name?
This is something rather difficult to implement due to Windows session isolation. IIS as well as its worker processes are in session 0, while your logon session is usually > 0. Via native Win32 API it is possible for something in session 0 to launch executable in other sessions, but I don't think it is worth the while.
Please use IIS Express, as it runs in your logon session directly, and don't need to cross the session boundary at all.
With regards to the Process.Start() problem I think in addition to changing the identity of the application pool you also need to go to Services under Administrative Tools and check the box "Allow the service to interact with desktop" under the Log On tab for the World Wide Web Publishing service. I think this has already been addressed in the following question: System.Diagnostics.Process.Start not work from an IIS
Now, if I had to put an app like this together I would try I slightly different approach: in addition to what you have already, I would build a small desktop app that autostarts and sits in the system tray when you log onto your desktop. It will listen for messages from the asp.net application on named pipes or tcp or something similar and start the processes from within the correct user context. That seems a more stable approach, which will also allow you to separate the web server from the desktop where the videos will be played.

Failed to create a window when launching it through reflection from the console app

Im trying to launch a dialog by invoking several methods from a windows forms assembly. My app is a console app. All the execution logic goes well and without exceptions, but the window is not launched. Is it a known issue that you cant launch a windows form from a console app?
well, yes. You have to have a Windows message loop for this to work.
If you create a Forms application from scratch, you'll see the Program.cs module created with ... Application.Run(new YourMainForm()) in it. Run is basically the message pump - having that is pretty much a requirement for forms to work.

Launch process on server from asp.net codebehind and have it visible on server desktop

I have a program running on my desktop machine that makes a WCF service available. This is a regular Windows Forms application that I run when logged in as a normal user.
I put the WCF interface in so that I could see the status of the program from an external web page. This works great, I can see the status of the running program and even change things as I see fit.
The only thing I can't do is start the program. If I go to the web page and the program is not running, I'd like to be able to start it. A simple Process.Start(programEXE) doesn't suffice because while the program starts, it is not on the desktop and I can't see it, though it does show up in Task Manager.
I tried creating credentials and launching the program with those credentials, but it exits with a very vague "Program failed to start" error, or starts with my credentials but still doesn't show up on the desktop. In the latter case, I see it in Task Manager under my name, but don't see the actual program.
So, How do I start a program on the server, visible on the desktop of the logged-in user (There's only one user and that user is always logged in)?
Also, what are some things that I can do to ensure that this doesn't become a security hole? One thought I had was to run the launcher.aspx in its own virtual directory, under a userid that only has read permissions to the one directory where program.exe is located, and has no other read or write permissions. Any other suggestions?
Finally, just to be clear: I am not trying to launch anything on the user's computer. Clicking on the "launch program" link should launch a program on the web server and not on the client machine, and that program should be visible to the logged-in user on the server.
I'm almost positive that you can't do that. Your IIS runs as service and does not have a specific desktop environment associated with it. What you're trying to do doesn't really work in the web/server environment.
I'd recommend that you change your win form app to a windows service and then you'd be able to start/stop it via web site. If you enable "interact with desktop" with the windows service then I think you'd be able to have a form.Show() bring the app to the current user's desktop environment.
If you are the only person that needs to run the winform app, then why not just start the app yourself? You state that it'll probably never be used by any computer other than your own computer, so it seems like a complicated method of accessing a local web site to start a local winform app when you could just start the winform app via shortcut.

Resources