.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Service Process Invocation

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :.NET Framework

In Win7, I am running a service which launches a process which hosts the office-library (Word 2007) for the purpose doing a mail-merge. There is no interface anywhere. When I launch the mail-merge process with the service as the parent Word cannot create a document using my existing mail-merge Word doc. At first I thought the problem lied with UAC so I changed the manifest to run as admin but it seems like that was irrelevant. When I launch the process from explorer or a non-service process instead of the service it works. It is able to load Word and a document successfully. I then proceeded to use Process Monitor to see if I could get some clues as to what could be happening. As far as I can tell, when the proc is launched by the service it is using system profile since I see file paths such as c:\windows\system32\config\systemprofile and c:windows\temp instead of my user profile folders C:\Users\UserName\AppData\Roaming\Application\ etc. My service is running as my username and not localsystem. I check the username using WindowsIdentity.GetCurrent().Name and I get my correct username regardless of service/non-service invocation. I tried changing the Word startup path in the Application object but again it only succeeds in non-service mode. I'm not really even sure if this post belongs here because it crosses a few technologies but I feel like the problem li

View Complete Post

More Related Resource Links

Cannot register a service type without attaching the source assembly to the host process

I'm wondering if there is any way I can register a service type without attaching the source assembly to the host process. When I register the service type, the source assembly (which has the type) cannot be written.   I appreciate your attention.. 

Create a new process in web service using delegated impersonation context

Hi, I've written an ASP.NET 2.0 web service which is consumed by a web application which goes out and gets configuration data back from newly built win2k3 servers in a large enterprise. I am using kerberos delegation and impersonation to pass through the users domain admin rights to interrogate the server which has just been built. The web pool identity (IIS 6.0) runs under a low priviledge service account. I have all the delegation part working ok. The problem I am having is that I want to programmatically kick off a process which executes a cmd line executable and redirects the output, all under the context of the user who's being impersonated. I understand that the process will be external to the impersonated thread, so will end up running under the worker process identity, which is why I'm getting an "access is denied" message. I've been reading about the CreateProcessAsUser and createprocesswithlogonw API functions but all I've seen is examples where people specifically state the username and password in their code. This is not something I can do as the environment is very secure, so what I need to do is seamlessly get the identity of the impersonated user, and some how feed that into a function which will create the process under the correct domain admins identity and feed back out the StdOuput. Is this something that can be achieved, and if so, how? Man

Analysis Service Process Dimension Cause : OLE DB error: OLE DB or ODBC error: ORA-00942: table or v

Dear Gurus, I'd face a "STRANGE" problem. I'm using SQL2008 connect to Oracle Data Source (OracleOldDB.1) When I process a snow-flake dimension . There is a ORA-00942 problem. But if I past the SQL Statement to a Oracle Tool . It worked without any problem. Does any body ever face this "STRANGE" problem ? And I'd try to remove this table from data-source-view and re-join it . Still same problem !!  Wilson

Setting process priority on C# 3.5 service project

Hi all,
  I'm working on a windows service that uses WCF with names pipes and Quartz.net to perform process scheduling.  Everything is running well, except I've hit a snag.  I have one process that's quite I/O intensive, and it kills my server while it runs.  Unfortunately, I'm legacied in to some of the architecture, so the process is as optimized as I can get it.  As a result of this, I have 2 questions.

1. Each of my jobs are encapsulated within a class.  Each of these classes are instanciated and run by Quartz in it's own thread.  When the Job starts, I have the following code in the Execute function

  /// <summary>
        /// Called by the <see cref="T:Quartz.IScheduler"/> when a <see cref="T:Quartz.Trigger"/>
        ///             fires that is associated with the <see cref="T:Quartz.IJob"/>.
        /// </summary>
        /// <remarks>
        /// The implementation may wish to set a  result object on the 
        ///             JobExecutionContext before this method exits.  The result itself
        ///             is meaningless to Quartz, but may be informative to 
        ///             <see cref="T:Quartz.IJobListener"/>s or 
        ///             <see cref="T:Quartz.ITriggerListener"

Execute process on remote machine from windows service



I am using Windows Management Instrumentation (WMI) to connect to a remote system. I am connecting to a remote system and executing an exe on the remote system. This works if it is a normal exe. I am passing the user name and the password as well.

But when I use the same code in a Windows Service, I get an error which says "Access is Denied." My requirement is to invoke the exe (every 2 hours) on client system from a windows service on the server.

My code looks like this:



processHandle As Integer
Dim connection

Execute process on remote machine from windows service



I am using Windows Management Instrumentation (WMI) to connect to a remote system. I am connecting to a remote system and executing an exe on the remote system. This works if it is a normal exe. I am passing the user name and the password as well.

But when I use the same code in a Windows Service, I get an error which says "Access is Denied." My requirement is to invoke the exe (every 2 hours) on client system from a windows service on the server.

My code looks like this:



processHandle As Integer
Dim connection

64 bit service runs as 64 bit process on some Win7 machines, but not others

We have a 64 bit service that we are using to do some processing outside of the web app. Its built with the AnyCPU flag, so I am assuming it should always run as a 64 bit process on any 64 bit OS.  It needs to access 64 bit IFilter dll's so we can parse text in a bunch of docx/pptx files.  What I've found though is that it will run as a 32 bit process on some versions of Win7 and also Windows Server 2003.  The other Win7 machine is basically the same laptop, so it should run exactly the same.  When it runs as a 32 bit, its accessing the SysWow64 dll's which don't do what we need it to do.  When I run it on XP x86, its a 32 bit process as expected and works fine.  Any idea's on what might be the cause?

Force fully kill a process in windows service?


Hi all, I am working on a windows service in which i execute a power point exe. I want to stop this exe after a perticular time duration.My code is something like this:

process1.Start(); // Process object to call the exe.
StreamReader myStreamReader = process1.StandardOutput;
StreamReader myStreamError = process1.StandardError;
string myID = myStreamReader.ReadLine();
string stdError = myStreamError.ReadLine();
if (process1.WaitForExit(int.Parse(ConfigurationSettings.AppSettings["PPTIMPMAX"]) * 1000))
processChk = 1;

Varun Kumar

Is there any way to use Process.Start in Windows Service?


We craete Deploy Windows Service. And it is installed on all servers.

When service get some new file deployment request, service deletes files and copy from ftp.

Anyway,if .exe file (deploy target file) is on process, service kills the process and copy the exe file, then start this file.

So I use Process.Start, but it does not operate.

When I debug source, there's no exception. So I checked "Allow service to interact with desktop", but the same.

And machines that installed service are various OS.

How can I solve this issue?

how to use visual studio to debug sql server reporting service 2008 by attaching process


I did custom security extension and want to debug it. I used to debug it using visual studio by attaching its iexplore.exe process using visual studio 2005 and sql server reporting services 2005. After then, I can debug UILogon.aspx.cs and AuthenticationExtension.cs in Microsoft.Samples.ReportingServices.CustomSecurity.dll. When I set break point, it can reach.

Now I used 2008 version for all application. After I attaching process, it can't reach break point I set. I realize sql server reporting services didn't use IIS and it use another component to hold web app. I may affect it and unable to debug it ? Do I need to do any configuration or any thing before I can use visual studio 2008 to do debug by attaching process ?




stop a service using http based .net remoting without terminating a process

I have a client server appliction and in this when i stop the service from the server i have to terminate the process but i dont want to terminate it  i.e closing the port without terminating the service host process

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Realizing a Service-Oriented Architecture with .NET

This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.

The Potential of Web Services

ASP.NET Architecture - ASP.NET Worker Process - HTTP Pipleline - Http Modules and Handlers

"ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET Http Pipeline to process requests.

Web Service for uploading documents into SharePoint

WS UploadService is a web service written for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 and is meant for uploading documents into SharePoint. I have just uploaded the zip file to GotDotNet.com so it will take some time before the zip file appears in the list of downloads. For the time being, you can download the zip file from the following location

Creating and Using an ASP.NET Web Service in Visual Web Developer

In addition to letting you create Web pages, Microsoft Visual Studio also lets you create Web services that use ASP.NET XML. Creating a Web service in Visual Studio is similar to creating a Web page. You can also use the Microsoft Visual Web Developer Web development tool to reference and use Web services that are in a Visual Web Developer solution, on your local computer or in a local or external UDDI directory. In this walkthrough, you will create the Web service in one solution and use it in another.

Tasks illustrated in this walkthrough include:

Creating a simple XML Web service in Visual Web Developer.

Creating a separate Web site that uses the Web service.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend