C# - Get Log From Process.Start?

Jul 21, 2010

I'm going to precompile an asp.net application in my custom c# form. How do i retrieve the process logs and check whether it is a successful process or not?

Here's my code

string msPath = "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\";
string msCompiler = "aspnet_compiler.exe";
string fullCompilerPath = Path.Combine(msPath, msCompiler);
msPath.ThrowIfDirectoryMissing();
fullCompilerPath.ThrowIfFileIsMissing();
ProcessStartInfo process = new ProcessStartInfo
{
CreateNoWindow = false,
UseShellExecute = false,
WorkingDirectory = msPath,
FileName = msCompiler,
Arguments = "-p {0} -v / {1}"
.StrFormat(
CurrentSetting.CodeSource,
CurrentSetting.CompileTarget)
};
Process.Start(process);

View 2 Replies


Similar Messages:

Start Batch Job From IIS / Start Exe File With System.Diagnostics.Process.Start With Another Account Is Disabled?

Oct 28, 2010

What is the right approach when users (authenticated domain admins) should be able to start batch jobs (usually exe files) from an IIS (7.x) aspx (c#) page? This is an intranet site. The batch jobs have to run on the web server as Domain Admins. The website pool is executed by network service or some similar restricted account in AD.

Approaches I can think of (and their disadvantages):
1. Start exe file with System.Diagnostics.Process.Start with another account. This feature is disabled in IIS 7.x, how do I allow it?

2. Create a sheduled task and call scheduled task-api. This unmanaged dll is giving VS compiler warnings because it's unsafe to call from managed code.

3. I suppose there's a better approach, because the previous suggestions doesn't appear safe or robust.

View 2 Replies

Configuration :: Process.start (System.Diagnostics.Process) - Execute A Batch File

Sep 7, 2010

I've written a aspx.net(C#) page that after the user has done what they do on the page they hit a Submit button. The Submit button

1) takes the work the users was producing on the page and writes it to a file.
2) attempts to execute a batch file.

The call to the batch file is executed via:

protected void Execute123EDI()
{
try
{
string File = @"c:80sAdminSendV80s.bat";
lblCancelled.Text = lblCancelled.Text + File;
Process proc = new System.Diagnostics.Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.LoadUserProfile = false;
proc.StartInfo.UserName = "administrator";
proc.StartInfo.RedirectStandardOutput = true;
System.Security.SecureString secPass = new System.Security.SecureString();
string paswd = "123abc";
for (int i = 0; i < paswd.Length; i++)
{
secPass.AppendChar(paswd[i]);
}
proc.StartInfo.Password = secPass;
proc.StartInfo.FileName = File;
proc.Start();
FileStream fs = new FileStream(@"c:80sAdminSendV80sOutput.log", FileMode.Append);
StreamWriter sw = new StreamWriter(fs);
sw.Write(proc.StandardOutput.ReadToEnd());
proc.WaitForExit();
sw.Close();
proc.Close();
}
catch(Exception ex)
{
lblDebug.Text = lblDebug.Text + ex.Message + "<br/>";
}

If I watch the processes tab in Task Manager on the web server I see "cmd.exe" under the context of 'administrator' but it just hangs. For test purposes c:SendV80s.bat: copy c: oot.ini c:zzz.txt

If I logon onto the webserver's console and execute SendV80s.bat it works and exits without issue. But when I execute the same batch file via the Submit button it gets stuck executing in Task Manager/Process. I believe this has something to do with the fact that cmd is not running in a full environment/desktop context. I just noticed this on the actual console of the webserver (not in my RDP console but console 0 instead)

A pop-up box stating: CMD.exe Application error The application failed to initialize properly (0xc0000142). Click OK to terminate the application. And when I click on the OK button my ASPX page's WaitForExit is satisfied and the continues processing normally.

View 2 Replies

C# - How To Start Process From Web Service (and Allow To It To Do Everything What It Wants To Do)

Jan 17, 2011

There is a Web Service installed on Amazon Server. Exposed WebMethod should start an executable. But, it seems that process (executable) started by WebMethod has not permissions to finish its job. If a WebMethod is called locally (using IE on Amazon VM) I can trace some events into log file placed on the path: C:\LogFiles. But, if it is called from remote machine, there is no even log files. Locally, on my machine all works fine.The question: is there any way or settings in IIS7 to allow to my WebService to create process that can do everything I want to do? In web.config file I added a line:

<identity impersonate="true" userName="USERNAME" password="password"/>
(userName and password are, of course, written correctly in the file).

Also, I tried to use impersonization as it is explained here, but there is no result. My process can't do its job, it cannot even trace actions into log file. Locally, on my machine, everything works fine.
how to change settings or whatever into IIS7?

EDIT: In addition to the main question: my WebService is not able even to create log files on the path: C:\LogFiles - although it is able if it started locally, but remotely there is no simple log file that contains some string. How to allow it to create simple text files?

View 3 Replies

Configuration :: Start A Process From A 4 App With IIS 7.5?

Jun 18, 2010

I have a web app that needs to start an application. It works great when using the debug server from VS2010 but once I deploy the web app and use the local IIS 7.5 server the application process starts in the background (no UI just a process visible in the task manager). The process is owned by DefaultAppPool. I Added DefaultAppPool user & IIS_IUSRS group to the program folder permissions but still no luck.I've found this old link on this problem but the solution doesn't apply to IIS 7.5.

View 4 Replies

VS 2005 Process.start() Don't Open Pdf File.

Jun 10, 2010

i am using a data list with link button in it that is dynamically populated by String list. i can get accurate path of the clicked link button from the data list, and the next step is to open that document. i am using process.start() method to open pdf file but it does not open that file.i am using the following code to open pdf file from specific path.
Code:
protected void lnkbtnFirstQtrly_Click(object sender, EventArgs e)
{
try
{
//dirCustom is the DirectoryInfo variable that is global variable.

[code]...

View 4 Replies

Web Forms :: Unable To Execute The Cmd Using Process.Start?

Apr 16, 2010

I am using asp.net 2005, and my deployement server is Windows Server 2003.

I am invoking a .bat (which executes some cmd) file from my asp.net page.

But the cmd prompt not getting invoked . the application is waiting for long time in Process.Start() and after some time i am getting asp.net time out error.

Note : a. Same application is working in another production server with windows 2003

b. i have checked with giving impersonation = true - It doesnt worked

c. I have checked with gsetting identity as 'Local System' , 'Local Server'in th eApplication pool of the IIS.

View 8 Replies

C# - Unable To Start External Process With Impersonate

Feb 24, 2010

Im deploying my website onto my new server (windows 2003) from my local pc (windows 7) and my local homeserver (windows 2008) and have run in to a issue.

I have a process that starts up with the below code. It is passed a video file which gets converted.

System.Diagnostics.ProcessStartInfo StartInfo = new System.Diagnostics.ProcessStartInfo(Command, Parameters);

Them problem I have is on my new windows 2003 server it fails to work. No error or anything. Looking at the server and its taskmgr.exe I see the Process start but nothing happens.

Looking into it, everyone seems to say I need to have impersonate="true" in the webconfig which I do have, I currently have it set to the Administrator account which I use to log into remote desktop (I assume this is fine???)

<identity impersonate="true" userName="Administrator" password="********" />

This still doesn't work.. Looking in the taskmgr.exe the process is started with the username ="NETWORK SERVICE" ...

View 1 Replies

System.Diagnostics.Process.Start Not Work From An IIS?

Jan 13, 2011

When I run System.Diagnostics.Process.Start from my console application it works but the same code when I run from my web service hosted in IIS doesn't work.

Is it some thing to do with ASP.Net privileges?? if yes how can I configure it from my C# code.

View 1 Replies

Security :: Cannot Run System.Diagnostics.Process.Start In Code Behind Under IIS

Jun 30, 2010

I can not run System.Diagnostics.Process.Start(@"wmplayer.exe") in code behind under IIS, - nothing happens, though I can do it successfully using Visual Studio ASP.NET Development server. I read topic http://support.microsoft.com/kb/555134 and made as recommended: 1) Made ASP.NET worker process run in SYSTEM account 2) Enabled IIS Admin Service to interact with desktop and rebooted serivce. - wmplayer.exe does not start, even its process does not start. I tried start notepad.exe and it partly works - process starts, I see only window frame, but not menu and can not interact with it. The other thing I tried is to put it under out-of-process (IIS virtual folder properties) and gave the process administrative rights (changed identity in Component Services): no result.

View 6 Replies

Process.start() Method Is Not Working In Server Machine?

Mar 29, 2011

In my project i am having the VB Script file openHTML.vbs which is used to open the .HTML file in the server location.

If i run the following code in VS2005 it's working fine but if i use the same code to publish and work in the server machine it's not working.

[Code]....

[Code]....

View 11 Replies

Configuration :: System.Diagnostics.Process.Start Not Working?

Jan 7, 2011

I have installed VS2008 on my development machine have winxp sp2 OS.i have created one aspx page where i have placed one button. On click of that button i want to open osk.exe(on screen keyboard). i an using following code

System.Diagnostics.Process.Start("osk.exe")i works fine there.Now for testing i deployed that application to testing server having Win7 OS and IIS7.0. It is not working there.

View 2 Replies

Configuration :: Opening A File With Process.Start Outside Root Folder?

Nov 6, 2010

So, I have a webForm that has an ImageButton. This ImageButton has to open a file (said file is uploaded by the user in another web form. The file is saved to \serverNamefiles; it can be a doc file, pdf file, excel file).

So this ImageButton should open said file as you normally would. It works on debug, however when I publish my site, and run it from my localhost, it doesn't open the file. When I click the ImageButton it just does the postback and nothing happens.

The code for the ImageButton is just:

Process.Start(fileName);

fileName has the full path of the file I want to open, in this case it has: \serverNamefilesmyFile.pdf

View 11 Replies

System.Diagnostics.Process.Start Not Work With IIS, But On Development Server?

Jul 26, 2010

System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server

View 3 Replies

Configuration :: System.diagnostic.process.start Not Working From Client Browser

Jul 15, 2010

I've an application where in am trying to show a slideshow directly on page load.. for that am using the following code

[Code]....

Its perfectly working on the dev environment but when deployed onto iis7.. am not able open the file..

I've given all folder rights for asp.net account and network service..

View 5 Replies

Configuration :: Diagnostics.Process.Start - Works In Development/debug Not Deployed?

Aug 27, 2010

Code]....

for example it just starts notepadn my development pc i'm using Win7 and when i deploy the app onto my local IIS7 it works and i can call notepadWhen i run debug mode with VS2010 it works too!

View 2 Replies

Visual Studio :: Unable To Start Debugging On The Web Server. The IIS Worker Process For The Launched URL Is Not C?

Jul 19, 2010

Unable to start debugging on the web server. The IIS worker process for the launched URL is not currently running.I'm running Windows 7 64 bit, VS 2008 sp1.When I first try to debug I get the error msg above. I wait a few minutes (presumably some service is starting) and debugging will start but no breakpoints are recognized.Some of the things I've tried:Changing the binding of my site from a static IP to "*".

Enabled windows authentication.made sure localhost = 127.0.0.1 in the hosts file.The website was built under windows xp and whatever version of IIS ships with xp. My web config has no errors that I know of but might be missing something required for iis 7 (??)

View 2 Replies

C# - Process.Start("url") Is Not Working In Proxy Environment

Apr 15, 2010

How i can pass WebProxy credentials like userid, password, IP,Port and domain. During proxy environment the url does not open.

View 1 Replies

Incorrect "Unable To Start Debugging - Attach To Worker Process" Message In Delphi 2007

Feb 2, 2010

I have seen this for a long time, and finally decided to put the question up here. I have some applications that I need to maintain that were written in Delphi 2007 for .NET (ASP.NET 2.0). Normally, the first time I run the application (using IIS) I get the classic "Unable to start debugging on the web server. Unable to attach to ASP.NET worker process" message. I simply press F9 (run) again, and it runs. Sometimes I have to try running several times before it will actually run. I am running Windows 7 64-bit (and have seen the same effect on Vista 64-bit). I do have IIS configured for ASP.NET, and I do have the following code in my Web.config file.

<system.webServer>
<modules>
<add name="DbgConnect" type="Borland.DbkAsp.DbkConnModule,Borland.dbkasp,Version=10.5.0.0,
Culture=neutral, PublicKeyToken=b0524c541232aae7" preCondition="managedHandler" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>

The point is that I eventually can run the application in the debugger, sometimes even on the first try. Many times when I get the failure it happens about 15 seconds or so after I press Run, sometimes even after I've hit a page or two (or three) of the Web app. And, yes, when Delphi gets into this mode, I can simply run without debugging, and all is fine (unless I really want to debug). And, I can just keep on trying to run in the debugger and eventually it will just work.

It appears that Delphi's .NET debugger is somehow getting the idea that the application cannot run, and then gives up and stops the process (which as I've mentioned is sometimes clearly running). I know of other developers who have also seen this behavior. My question is, does anyone know how to stop this annoying behavior?

View 2 Replies

Visual Studio :: Unable To Start Debugging "Auto - Attach To Process (8360) W3wp.exe On Machine DELL Failed" - 2008

May 10, 2010

suddenly, with my Visual Studio 2008 I can no longer debugging my web applications (ASP.NET 3.5). I obtain this error: Unable to start debugging on the web server. Click Help for more information. Auto-attach to process [8360] w3wp.exe' on machine 'DELL' failed. The weird thing is that I haven't done special changes to my IIS.

View 1 Replies

Web Forms :: "No Application Is Associated With The Specified File For This Operation" Error When Trying To Open File With Process.Start()

Oct 11, 2010

I have a folder called GUI. Inside GUI thers another folder called PDF and inside this folder, there are some PDF files. This folder (GUI) is uploaded to the server too. Then I have a WebForm with some ImageButtons. When I click one of these ImageButtons, I want the file to open in a new tab. I tried with the following code:

[Code]....

As you can see, I build the path using the tooltips of the different ImageButtons. The ToolTip = File Name I want to open. When I try this in debug mode, it works. It opens the pdf file in a new tab. However when I publish my website and upload it to the server... it doesn't work... when I click an ImageButton I get the following exception: No application is associated with the specified file for this operation

Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
Source Error:

[Code]....

Stack Trace:

[Code]....

[Win32Exception (0x80004005): No application is associated with the specified file for this operation]
LandingSite.LnkRelease1_Click(Object sender, EventArgs e) +215
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082

View 3 Replies

C# - Application Running Under A Less Privileged Account Start A Process Executing Another Application Under An Administrative Account?

Mar 9, 2011

I am logged in as the administrator when I installed an application named pdflatex.exe on my server. This application works as a converter from LaTeX input file to Pdf file. I host an Asp.net MVC 3 application running under an Application Pool Identity with Load User Profile = True. The Asp.net MVC 3 code contains a code that executes pdflatex.exe using System.Diagnostic.Process instance as follows:

Process p = new Process();
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(p_Exited);
p.StartInfo.Arguments = "-interaction=nonstopmode " + inputpath;
p.StartInfo.WorkingDirectory = @"c:mydomain.comworking";
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "pdflatex.exe";
p.Start();
p.WaitForExit();

From the scenario above, the web application runs under a restricted acount but it executes an external application under a default account that I don't know. Can an application running under a less privileged account start a process executing another application under an administrative account?

View 2 Replies

C# - Registering Routes On Session Start Not Application Start?

Jan 26, 2011

I am trying to register the route collection in .net based on each session. The code I have works fine, you goto website/username and it loads the correct sub pages, but you have to restart the application to goto website/username2 to load those sub pages. But when the application is restarted the second one works, but then not the first one. Is there some way to create a different route collection per session not per application using system.web.routing.

View 3 Replies

Long Running HTTP Process - How To Put In Separate Process

Jul 21, 2010

I know that similar questions have been asked all over the place, but I'm having trouble finding one that relates directly to what I'm after.

I have a website where a user uploads a data file, then that file is transformed and imported into SQL. The file could be up to 50mb in size, and some times this process can take 30 minutes or sometimes even longer.

I realise I need to palm off the actual work to another process, and poll that process on the web page. I'm wondering what the best approach would be though? Being a web developer by trade, I'm finding all this new Windows Service stuff a bit confusing, and I just wanted somewhere to start.

So:

Can I do / should I being doing this with a windows service? if so, how?

Should I use WCF? If this runs under IIS, will I have problems with aspnet_wp.exe recycling and timing out my process?

clarifications

The data is imported into sql, there's no file distribution taking place.

If there is a failure, it absolutely MUST be reported to the user. The web page will poll every, lets say, 5 seconds, from the time the async task begins, to get the 'status' of the import. Once it's finished another response will tell the page to stop polling for status updates.

queries on final decision

ok, so as I thought, it seems that a windows service is the best idea. So as to HOW to get it to work, it seems the 'put the file there and wait for the service to pick it up' idea is the generally accepted way, is there a way I can start a process run by the service, without it having to constantly be checking a database table / folder? As I said earlier, I don't have any experience with Windows Services - I wondered if I put a public method in the service, can I call it somehow?

View 2 Replies

Execute A Process Remotely With System.Diagnostics.Process

Feb 26, 2010

I'm working on an ASP.net app I'm trying to execute a process remotely , using System.Diagnostics.Process class here's my code:

ProcessStartInfo startInfo = new ProcessStartInfo(@"C:TestCommand.exe");
startInfo.Domain = "myDomain";
startInfo.UserName = "MyUserName";
SecureString sec = new SecureString();
foreach (char item in "MyPassword")
{
sec.AppendChar(item);
}
sec.MakeReadOnly();
startInfo.Password = sec;
startInfo.UseShellExecute = false;
Process.Start(startInfo);

I keep receiving an exception with the message "Logon failure: unknown user name or bad password". Im absolutelly sure that i'm submiting my correct username/pwd

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved