question

kailashsolanki-9288 avatar image
0 Votes"
kailashsolanki-9288 asked ·

How to open Console App from MVC web application

I have deployed MVC application in IIS, and from this MVC application i want to open console app. so that is not possible due to IIS security .

Now i have create one package installer add added console application exe in Application and decalared protocol of package and i have installed that package on my pc and i am able to see the protocol.

now in MVC controller i am writing code to open protocol

              Uri uri = new Uri("myprotocol:");
              var psi = new ProcessStartInfo();
             psi.UseShellExecute = true;
             psi.FileName = uri.ToString();
             Process.Start(psi);

but i am getting below exception -

System.Exception: A specified logon session does not exist. It may already have been terminated
---> System.ComponentModel.Win32Exception: A specified logon session does not exist. It may already have been terminated

is there any solution on this.

if i replace console app to UWP that is working fine for me but i want Winform OR console App but in both not able to open from IIS.

dotnet-aspnet-mvc
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

surferonwww avatar image
0 Votes"
surferonwww answered ·

i want Winform OR console App but in both not able to open from IIS.

It is NOT possible because IIS runs without a user interface. You can check if the Environment.UserInteractive Property in your web application.

Environment.UserInteractive Property
https://docs.microsoft.com/en-us/dotnet/api/system.environment.userinteractive


· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Now i have changed application type console to WPF still getting same exception ?

0 Votes 0 ·