.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

Create a new process in web service using delegated impersonation context

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :.NET Framework
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

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.. 

How to create simple web service in VS2010, NOT WCF service

How to create simple web service in VS2010 Professional (trial version). There is no template to do this.  I am not trying to create WCF service here.

Errors attempting to process SSAS Cube. I get Either user does not have permission to create a new o

Hi All, One of my production server deployed cubes i am not able to process the cube.When i tried to process the cubes i will get an Error: TITLE: Microsoft SQL Server Management Studio ------------------------------ Either the 'NA\gsad478' user does not have permission to create a new object in 'JNJAUSYSVR01', or the object does not exist.  (Microsoft.AnalysisServices)   Over the source server i do have sysadmin access and also  i have added read only role of particular cube. I right click on the database and tried to create new database of SSAS that also thrown with same error. Please help me in this regard.   Thanks, Gangadhar

Documentation on impersonation of Windows LiveID with data service?

Hi There, I'm not finding any documentation on impersonating a Windows LiveID over a WCF data service. I can find documentation on Windows Auth. For example, this article is great, but its first step is "Configure Your Service to Use Windows Authentication": http://geekswithblogs.net/manesh/archive/2009/04/23/setting-up-wcf-to-impersonate-client-credentials.aspx. I'm not sure how to do this when I'm working with the LIVEID. Alternatively, and even preferably, if there's a way I can manipulate the connection string the data service is using from the WCF endpoint, that would be ideal. I need to grab some info about the user in the Silverlight app that's using the data service, and somehow impersonate that user. The user is a Windows LiveID, which is what I have hard-coded in my connection string in my web.config. Thanks!  Web: http://invoc.net

Get the error 'The Workstation service has not been started' when trying to create a new content d

I am running SharePoint on a standalone machine, and the workstation service is up and running. Restarting the service makes no difference. Rebooting the machine hasn't helped either. No errors are being written to the event log.

How to create WEB SERVICE

HI ALL, I have to create web service from which i do want to call SSIS package ,Kindly suggest.   Amit 

Invoking custom WCF service throws an Impersonation error from SQL

I've written a custom WCF service and hosted it in SharePoint. Accessing the MEX endpoint works fine. However, when I try to invoke the WCF service from my client code, I get the following error: 'A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - Either a required impersonation level was not provided, or the provided impersonation level is invalid.)'. This exception gets thrown even before my WCF service gets invoked. Attaching a debugger, I see the following stack trace associated with the exception: 00000000`0c2dd7d0 000007fe`e7589b95 System_Data_ni!System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean)+0xd4 00000000`0c2dd810 000007fe`e7b7cd3b System_Data_ni!System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject)+0xf5 00000000`0c2dd870 000007fe`e758c4ee System_Data_ni!System.Data.SqlClient.TdsParserStateObject.WriteSni()+0x5f77ab 00000000`0c2dd8f0 000007fe`e758bf29 System_Data_ni!System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()+0xae 00000000`0c2dd950 000007fe`e757a1c7 System_Data_ni!System.Data.SqlClient.TdsParser.TdsExecuteRPC(System.Data.SqlClient._SqlRPC[], Int32, Boolean, System.Data.Sql.SqlNotificationRequest, System.Data.SqlClient.TdsParserStateObject, Boolean)+0x1189 00000000`0c2ddbf

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

how to create a doc library item using web service

Hi, I think this is a common question, but I coulnd't come up with anything at this point. I'd like to create an item in a document library using SP web service. - no uploading a file. I have created an item using ../copy.asmx web service. Using the WS function(copyWebService.CopyIntoItems function), it seems suitable to create an item AND at the same time to upload a file. I don't think I can just create an item with this function. How do i just create an item? any reply is appreciated.  

Web Service ParserError Could not create type

Getting error message with our web service: Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not create type 'ATGIntegration.B2CBlueprintOMSIntegrationWSBinding'. Source Error: Line 1: <%@ WebService Language="vb" CodeBehind="Service.asmx.vb" Class="ATGIntegration.B2CBlueprintOMSIntegrationWSBinding" %>   Two versions of this web service installed on a server (one for development) with the only difference being the web.config file. Web service worked without error for over a year. Recently made some changes to the code, compiled and copy and pasted bin files to the bin folder for the development web service. Then this error appeared. Then I put back the original bin files but same error. At this time the live web service was still working. Later I copied bin folder from live to dev and that broke live. I can fix this error by rebooting the machine, accessing the web service in error, making any change to the web.config file and finally accessing the web service again. The problem is that this error re-appears after a random period of time for no obvious reason. I follow the process again to fix. I have done this process 8 times now. Both dev

Create a new target application - Secure Store Service administration issues

Hi,I am trying to create new target application, when I go to Secure Store Service in Centra admin I have:Cannot complete this action as the Secure Store Shared Service is not responding. Please contact your administrator.I have used this few days ago and avarything else is working fine on the server, and I have applications created with it running fine.Any help is appreciated.cheersValko

How does one create context-sensitive custom help files?

We are an ISV and would like to know how to add a feature to our solution that uses the existing help functionality to display help based on the user type and context of that user type in the system.  I have been searching to no avail, if there is a How-To article somewhere I'd love a link! Thanks, -Torrance R. MillerIntegrating the future into today

Create Multiple datafields in a Web Service

I have been working on this for awhile.  What I am trying to do is to retrieve the telephonenumber, mail and physicalDeliveryOfficeName from active directory  I have debugged it and it seems to work but when I connect to the data source in Infopath, there is no value.  Also, the data source has a group field called "choice."  I have no idea what that is.  I am using a contact select to fill out and the value of the AccountId will populate another field.  I use this field to choose the LoginName on the query and then run the query on the data source.  This should pupulate the email, phone, and location fields on the main data source.  Here is a sample of my code: Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Net Imports Microsoft.sharepoint Imports Microsoft.SharePoint.WebControls Imports System.DirectoryServices Imports System.Data ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://microsoft.com/webservices/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem(False)> _ Public Class GetADProperty     Inherits System

Cannot create unknown type when loading WF Service from loose Xaml with ActivityXamlServices


I am trying to host a WF4 (RC) Service dynamically. I have a test solution with two projects. The first is a declarative workflow service library with one root Flowchart activity in it, and a simple custom code activity. The workflow service library does not depend on any other custom assemblies or references. The second is my host app, which in my test solution is just a console application.

In my host app, I am attempting to the use ActivityXamlServices to load the Xaml for the workflow service into an activity, and then use the WorkflowServiceHost to fire up a workflow instance using that activity.

As soon as I try to new up the WorkflowServiceHost object, I get this exception...

Cannot create unknown type '{clr-namespace:DeclarativeServiceLibrary1}CodeActivity1'.

If I remove CodeActivity1 from my Flowchart designer, everything runs fine. If I add a direct reference to the workflow service project from my host project and then create a WorkflowServiceHost using an instance of my Flowchart activity instead of the activity created from the Xaml, it also works fine.

It seems to not like using my CodeActivity for some reason when loaded dynamically.

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"

Need to create a service to allow client application to update their data



I want to create a  WCF Service to transfer data to our clients application(WPF).

The Data I am trying to send is as follows.

ID  Code          Description   unit    Rate

1   104200000   LIVE GOAT      NOS     25

2   104200000   LIVE GOAT2    NOS    25

3   104200030   LIVE GOAT3    KGS     10

4   104202030   Water             LTR      5

and so on till ~ 11000 records.

What I have done so far is. Created a service which return a list of data.


 public List<Classes.TariffData> GetTariffData()
var currentTariffData = new List<Classes.TariffData>();

using (var myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
const string query = "select a.ID,a.Code,a.Description,a.unit,a.rate,a.rate3 from tariff.dbo.tariffdata a, tariff.dbo.code_history b where a.id = b.id and b.endofvalidity is null";
using (var myCommand = new Sq

create web service with http-post method


hi All,

we need to expose a web service to the 3rd party vendor which can only call using POST protocol, NOT SOAP.

So my question, is it better to build a web service or just simply .aspx page?

Also is there any best practice documentation on this.



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