This documentation is archived and is not being maintained.

ServiceReferenceCollection Class

Contains a set of ServiceReference objects.

Namespace:  System.Web.UI
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class ServiceReferenceCollection : Collection<ServiceReference>

The ServiceReferenceCollection object contains a ServiceReference object for each Web service that is registered in an AJAX-enabled ASP.NET page. Web services can be defined in the ScriptManager control or in an associated ScriptManagerProxy control.

You can add Web services to the ServiceReferenceCollection object declaratively by adding one or more <asp:ServiceReference> elements to a <Services> element inside the <asp:ScriptManager> element on the page, as shown in the following example.

<asp:ScriptManager ID="SM1" runat="server">
    <asp:ServiceReference Path="Service1.asmx" />
    <asp:ServiceReference Path="Service2.asmx" />

You can also programmatically add a ServiceReference object to the Services collection by using the Add method of the ServiceReferenceCollection class.

Web services are registered with the ScriptManager control during the page's PreRender life cycle stage.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5