Welcome to www.programmer2programmer.net tips for IT Interview Questions of .NET Server Components

programmer2programmer.net

 Tips
 Microsoft Certification
 Final Year Project Idea
 Connection Strings
 Password Recovery
 SQL Injection
 Encryption & Decryption
  
 LIVE Academic Project
 Project #1 - VB6, Access
  Project #2 - VB.Net, SQL
 Project #3 - ASP, Access
 Project #4 - ASP.NET, C#
 Project #5 - VB6, SQL
 Project #6 - Stegano
 Project #7 - C
 Project #8 - C++
 Project #9 - JAVA, MySQL
 Project #10- PHP, MySQL
 Project #11- JSP, Oracle
 Project #12- C# Face Exp
 Project #13- Mobile Bank
 Download MBA Project
 MBA Project Topic
 Project Viva Question
  2017 New Projects
 Project Synopsis Download
  
 University Question Paper, Assignment and Projects
 SMU - Question Paper
 SMU - Assignment
 SMU - Synopsis Projects
 SCDL - Assignment
 IGNOU - Synopsis Projects
 Welingkar - Projects
 Project Report Formats
  
 Interview Question Answer
 General & HR Round
 Visual Basic 6
 VB.Net & C#
 ASP.Net
 SQL Server
  Oracle and DBA
 My SQL
  

100% Tested
Ready Academic IT Projects

BE, ME, BTech, BCA, MCA, MBA, Bsc-IT, MS, BIT, ADIT, DOEACC, IGNOU, SMU
readymadeproject.com

 Interview questions and Answers for .NET Server Components, Windows Service, COM+ and XML Web Service

Home Personal Member Forum Source Project Tips Contact
 

Interview Question - VB.NET and C# - Windows Service, COM+ and XML Web Services interview questions and answers

Interview questions and answers Server Components, Windows Service, COM+ and XML Web Services interview questions and answers

NET Framework Server Componentes, Windows Services, COM+, XML Web Services, Service Application, Event Logs, Service Control manager, Windows DNA, EnterpriseServices, remoting boundaries, channels, remoting applications, XML Documents, XPathNavigator, XML Web service, Web configuration

Advanced .NET Framework C#, VB.NET Interview Question and Answers for .NET Framework Version 2.0, 3.0, 3.5, 4.0

Interview Question, Answer
1.  Programming General
2.  Web General
3.  Database General
4.  Visual Basic 6
5.  ASP
6.  Visual Basic .NET and C#
7.  ASP .NET
8.  ORACLE
9.  MS SqlServer
10. MySql
11. COM, DCOM

1.

What are the states of a service application?

The states in which a service application can remain are running, paused, stopped, and pending.
 

2.

What are the different types of Windows services?

Windows services are of two types: Win32OwnProcess and Win32ShareProcess services. Each Win32OwnProcess runs in its own process space, whereas Win32ShareProcess services share a process space with other services.
 

3.

What are the tasks that you perform to create a Windows service?

 

These tasks are performed when creating a Windows service:
o Create a blank Windows service by using the Windows Service template for Visual Studio .NET.
o Change the default properties of the Windows Service template according to your requirements.
o Write code in the service application project to handle various events.
o Add installers to your service application.
o Install your service application by using the installation tools.
 

4.

How do you add functionality to a service application?

To add functionality to a service application, you override the OnStart and OnStop methods of the ServiceBase class. You can also override the OnPause, OnContinue, and OnCustomCommand methods of the ServiceBase class to increase the functionality of a service application.
 

5.

How do you log custom information in the default event logs?

 

To enable your service application to access the default event logs and write information in them, set the AutoLog property of a service application to False. You then use the WriteEntry method of the EventLog class log to write information in the default event logs.
 

6.

Why do you need to include installers in your service application?

The installers enable you to install a Windows service and resources, such as custom logs and performance counters, that a service application uses on a computer. The installers automatically install these resources when you install a service application using the Installutil tool.
 

7.

Why do you need to add instances of both the ServiceProcessInstaller and ?ServiceInstaller classes to install your service application?

 

A service application can contain more than one service. The methods of the ServiceProcessInstaller class perform the tasks that are common for all the services within a service application, such as writing entries in the system registry for all the services within the service application. The ServiceInstaller class performs tasks specific to a service, such as creating an entry for a service in the registry of a computer.
 

8.

How do you specify the security context of a user account within which a service application runs?

 

You use the Account property of the ServiceProcessInstaller class to specify the security context for your service application. To specify the security context of a user account, set the Account property to User. You then need to specify the user name and password of a user account when you install the service application.
 

9.

What administrative tasks can you perform on your service using the SCM?

 

You can perform the following administrative tasks using the SCM:
o Change the state of a service
o Specify how to start a service
o Specify the recovery actions in case of a service failure
o Specify a user account for a service
o View service dependencies
 

10.

What are the steps to run custom commands on your service application?

 

• The steps to run custom commands on your service application are
• Create a Windows application that you use to control your service application.
• Create a method that calls the ServiceController.ExecuteCommand method in the Windows application.
• Override the OnCustomCommand method in your service application to specify the tasks that you want your service application to perform.
 

11.

What are the steps to attach a debugger to your service application?

 

The steps to attach a debugger to your service application are:
• Start your service application using the SCM.
• Choose Processes from the Debug menu.
• Select Show System Processes.
• Select the process for your service application and click Attach. The Attach To Process dialog box appears.
• Select Common Language Runtime, click OK to specify a debugger, and close the Attach To Process dialog box.
 

12.

How is COM+ related to the DNA architecture?

 

Windows DNA provides the infrastructure and services that enable you to create and deploy applications based on the three-tier architecture. COM+ services, which are an integral part of Windows DNA, include services such as transactions, queued components (QC), security, loosely coupled events, JIT activation, and object pooling.
• Briefly explain the use of the following COM+ services:
o JIT activation
o Queued components
o Object pooling
Just-in-time activation. The Just-In-Time (JIT) Activation services of COM+ ensure that the client application has references to objects as long as they require them. As a result, the client application does not need to use the valuable memory resources of the server to save the object references.
Queued components. The Queued Component service of COM+ is based on the Microsoft Message Queue Server (MSMQ) model that is a part of Windows 2000 and Windows XP. MSMQ is a middle-tier service that facilitates the asynchronous delivery of messages to named queues. The MSMQ system queues up the method calls and executes them automatically as and when the component is available. You can, therefore, use queued components to execute client methods even after the component is unavailable or offline, ensuring the continuous running of a distributed application.
Object pooling. COM+ provides an automated service for configuring a component so that it can maintain ready-to-use and active object instances in a pool to process client requests. To configure and monitor the pool, you specify characteristics such as the pool size and the creation request time-out values. Next, the COM+ service is responsible for managing the pool and ensuring the activation and reuse of the pool objects according to the configured specifications.
 

13.

What is a serviced component?

 

A serviced component is a class that derives from the System.Enterprise?Services.ServicedComponent class, which is the base class for all classes that use COM+ component services. You create and register each service component before it can access the COM+ services.
 

14.

Which class do you need to define when creating serviced components?

 

To create a serviced component, you need to define a class that is derived directly from the ServicedComponent base class.
 

15.

How do you assign a name and ID to a COM+ application?

 

The application ID serves as an index for all application searches made during the registration process. The application ID is assigned by using the ApplicationID attribute that is derived from the System.EnterpriseServices namespace.
 

16.

What is the importance of the activation type attribute in the registration of a serviced component?

You use the activation type attribute to specify whether the created serviced component is created in the library of the caller process or in a new process of the server.
 

17.

Which tool is used to add a strong name to an assembly?

You can use the Strong Name Tool (sn.exe) to create the file containing the public key information.
 

18.

Which procedures can be used to register serviced components?

COM+ services use the following three types of registration for a serviced component:
a. Manual registration
b. Dynamic registration
c. Programmatic registration
 

19.

How do you configure a serviced component for implementation of role-based security at the interface level?

 

To assign roles to a component, method, or interface, complete the following steps:
• In the console tree of the Component Services tool, locate the COM+ application for which the role is defined.
• Expand the tree to view the components, interfaces, or methods of the application, depending on whom you are assigning the role.
• Right-click the item to which you want to assign the role and click Properties.
• In the properties dialog box, click the Security tab.
• In the Roles Explicitly Set For Selected Item(s) list box, select the roles that you want to assign to the item.
• Click OK.
 

20.

What are the requirements to enable communication between objects across remoting boundaries?

To enable communication between objects across remoting boundaries, you need
o A server object that exposes the functionality to callers outside its boundary
o A client that makes calls to the server object
o A transportation mechanism to pass the calls from one end to the other
 

21.

Describe the two types of remotable objects.

The two types of remotable objects are
o Marshal-by-value objects. These objects are copied and passed by value out of the application domain.
o Marshal-by-reference objects. The clients that use these objects need a proxy to access the object remotely.
 

22.

Describe the two types of activation modes of the .NET Remoting system.

The two types of activation modes in the .NET Remoting system are
o Server activation. In server activation, objects are created on the server when you call a method in the server class. However, objects are not created when you use the new keyword to create an instance of the server class.
o Client activation. In client activation, objects are created on the server when you create an instance using the new keyword.
 

23.

How can you renew lifetime leases of objects?

 

You can renew the lifetime lease of an object in the following two ways:
o A client application calls the ILease.Renew method.
o A sponsor renews the lease.
 

24.

What are channels?

 

Channels enable an application that is running in one application domain, process, or computer to send messages to an application running in a different application domain, process, or computer. In addition, channels allow applications to send and receive messages using protocols, such as TCP and HTTP.
 

25.

List the tasks you need to perform to publish a service outside the service domain.

• To publish a service outside the service domain, you need to:
o Identify the application domain that will host the service.
o Identify the activation model: server activation or client activation.
o Identify and create a channel and a port.
o Identify how the client application obtains the metadata information about the service.
 

26.

Why do you use delegates in your remoting applications?

You use delegates to implement callback functions, event programming, and asynchronous programming in your remoting applications. Events use delegates to enable callback functions to the client in remoting applications. This enables the client and the remote application to function as domain servers. Therefore, you need to design a server/server application instead of designing a client/server application.
 

27.

What steps do you perform to implement asynchronous programming in a remoting application?

The steps to implement asynchronous programming in a remoting application are
1. Create an instance of an object that can receive a remote call to a method.
2. Wrap that instance method with an AsyncDelegate method.
3. Wrap the remote method with another delegate.
4. Call the BeginInvoke method on the second delegate, passing any arguments, the AsyncDelegate method, and some object to hold the state.
5. Wait for the server object to call your callback method.
 

28.

What information do you need to provide to the .NET Remoting system to configure remote objects?

You must provide the .NET Remoting system with the following information to configure remote objects:
o The activation type for the remote object
o The channels that the remote object will use to receive messages from clients
o The URL of the remote object
o The type metadata that describes the type of your remote object
 

29.

Which method will you use to load the contents of an XML file into an ?XmlDocument object?

You need to use the Load method to load the contents of an XML file into an XmlDocument object. Alternatively, you can use the LoadXml method to load the XML data from a string format into the XmlDocument object.
 

30.

Which method will you use to write the contents of the XmlDocument object into an XML file?

You need to use the Save method of the XmlDocument class to write the contents of the XmlDocument object into an XML file.
 

31.

How do you read the contents of an XML document using XmlTextReader?

You need to perform the following tasks to read the contents of an XML document using XmlTextReader:
o Create an object of the XmlTextReader class.
o Call the Read() method on the reader object until all the data is read.
o While reading the data from the XML document, check the type of the data being read using the XmlTextReader.NodeType property.
 

32.

Which class do you use to write data to an XML file?

You use the XmlTextWriter class to write to an XML file. The XmlTextWriter class provides methods such as WriteStartDocument, WriteStart?Element, WriteAttributeString, WriteEndElement, and WriteEndAttribute, which you use to write data in a well-formed XML document.
 

33.

How does XPathNavigator read data from an XML document?

The XPathNavigator object reads data from an XML document by using a cursor that enables forward and backward navigation within the nodes. XPathNavigator enables you to randomly access any node in an XML document. However, the XPathNavigator cursor is read-only; therefore, you cannot edit an XML document with XPathNavigator.
 

34.

Which methods of the XPathNavigator class do you use to navigate within the nodes selected from an XML document?

You can use the MoveTo, MoveToNext, MoveToPrevious, MoveToFirst, MoveToFirstChild, MoveToParent, MoveToRoot, and MoveToId methods to navigate within the nodes selected from an XML document.
 

35.

What objects are used to create the structure of an XML document within a schema?

The simpleType and complexType elements are used to specify the structure of the XML document in the XSD schema file.
 

36.

Which event is raised for validating the semantics of the XML Schema?

The XmlValidatingReader.ValidationEventHandler event for the ?Compile method is raised for semantic validation checking of the XML Schema.
 

37.

How can you ensure your XML document is valid?

You can ensure the validity of XML documents by using the Xml?Validating?Reader class. The XmlValidatingReader class provides DTD, XDR, and XSD schema validation services. The XmlValidatingReader class takes XmlTextReader as input. XmlValidatingReader applies the property that you specify in XmlTextReader.
 

28.

How can you read fragments of an XML document?

You can use XmlValidatingReader to read XML fragments. Xml?ValidatingReader parses a given string as a fragment of XML. This enables you to bypass the root-level rules of an XML document. The value you pass to the XmlNodeType parameter of XmlValidatingReader determines how to parse an XML string.
 

29.

Which method enables you to retrieve the XSD schema for the XML representation of the data stored in the DataSet?

The GetXmlSchema method enables you to retrieve the XSD schema for the XML representation of the data stored in the DataSet.
 

40.

Which method of the DataSet class enables you to write the contents of a DataSet into an XML file?

The WriteXml method of the DataSet class enables you to write the contents of a DataSet into an XML file.
 

41.

What is an XML Web service?

XML Web services are program components that allow you to build scalable, loosely coupled, platform-independent applications. XML Web services enable disparate applications to exchange messages using standard protocols such as HTTP, XML, XSD, SOAP, and Web Services Description Language (WSDL).
 

42.

What are the components of the XML Web service infrastructure?

The components of the XML Web service infrastructure include XML Web services directories, XML Web services discovery, XML Web services description, and XML Web service wire formats.
 

43.

What are the steps to deploy a Web service?

Follow these steps to deploy a Web service:
1. Copy the files for your XML Web service application to the ?Inetpub\Wwwroot folder.
2. Open Internet Services Manager from the Administrative Tools folder.
3. Expand the Default Web Site node.
4. Right-click the Web service folder you copied to the Inetpub\Wwwroot folder to open its properties dialog box.
5. Click Create in the properties dialog box to configure the virtual folder as the root of your Web application.
 

44.

What are the components that are published when you deploy a Web service?

The components that are published when you deploy a Web service are
o The Web application directory
o The <WebService>.asmx file
o The <WebService>.disco file
o The Web.config file
o The \Bin directory
 

45.

What does the .disco file contain?

A .disco file contains links to other resources that describe your XML Web service and enables clients to discover an XML Web service. The discovery document contains information regarding other XML Web services that reside on the same or a different Web server.
 

46.

What are the steps to configure discovery information for an XML Web service?

To configure discovery information for an XML Web service, perform the following tasks:
0. Create an XML document and insert the <?xml version="1.0" ?> tag in the first line.
1. Add a <discovery> element.
2. Add references to service descriptions, XSD schemas, and other discovery documents within the <discovery> element.
3. Deploy the discovery document to a Web server.
 

47.

What tasks do you need to perform to consume a Web service in a client application?

To consume a Web service from a client application, you need to perform the following tasks:
0. Add a Web reference to the XML Web service in the client application by discovering the XML Web service you want to consume.
1. Generate a proxy class for the XML Web service.
2. Create an object of the XML Web service proxy class in the client application.
3. Access the XML Web service by using the proxy object.
 

48.

Which attribute is used to create a Web method?

In C# you use the [WebMethod] attribute to declare a Web method that exposes the functionality of the XML Web service. In Visual Basic .NET, you use the <WebMethod> attribute to create a Web method.
 

29.

Which file contains configuration information, such as debug mode?

The Web.config file contains configuration information, such as the debug mode and the authentication mode for a Web project. It also includes information about whether to display custom errors for a Web project.
 

50.

Which file allows you to handle application-level events?

The Global.asax file enables you to manage application-level events. This file resides in the root directory of an ASP.NET Web application or ASP.NET Web service. The Global.asax.cs or Global.asax.vb class file is a hidden, dependent file of Global.asax, which contains the code for handling application events such as the Application_OnError event.
 

51.

Which property of the WebMethod attribute allows you to maintain the state of objects across sessions in a Web method?

The EnableSession property of the WebMethod attribute allows you to enable session state for a Web method.
 

52.

What steps do you need to perform to enable transactions in a Web method?

To enable transactions in a Web method, you need to perform the following steps:
1. Add a reference to the System.EnterpriseServices.dll by using the ?Solution Explorer.
2. Include the System.EnterpriseServices namespace in the XML Web service project.
3. Set the TransactionOption property to an appropriate value.
 

53.

When should you use asynchronous programming?

You should use asynchronous programming when your application calls a method on an object that takes significant time to execute and you do not want the program to wait for the method to return.
 

54.

Explain how you implement asynchronous programming using callbacks.

A client calls the Begin method on the server object and passes a reference to the callback method. When the asynchronous method finishes execution, the server object calls the callback method on the client object. The callback method in turn calls the End method on the server object. The End method returns a value to the client.
 

55.

Which method do you call for the first time when you access an XML Web ?service or service method with which the SOAP extension is configured to ?execute?

You call the GetInitializer method the first time when you access an XML Web service or service method with which the SOAP extension is configured to execute.
 

56.

What are the different properties of the <add> XML element?

Type, Priority, and Group are the three properties of the <add> XML element. The Type property of the <add> element represents the type of SOAP extension. The Priority property represents the relative priority of the SOAP extension within a group. The Group property represents the group name to which the SOAP extension belongs.
 

57.

Which element in the Web.config file do you use to manage custom error ?messages?

You use the <customErrors/> element to manage custom error messages. You can set the <customErrors> mode attribute to On or RemoteOnly to enable custom error messages, and Off to disable the error messages.
 

58.

How can you ensure that only authorized users access your Web service?

You can use the <authorization> element to specify the users and roles that can access your Web service. This element enables you to implement both positive and negative authorization assertions. You can use this element to allow or deny access to your Web service based on specific users or roles.

Next  .NET Assemblies, Configuration, and Security interview questions and answers            Go back to Interview Question Main

(C) Atanu Maity, 2006-2017