This article was translated by machine. To view in the article in English, select the English check box. You can also display the English text in a popup window by moving the mouse pointer over the text.
الترجمة
الأصلي
This documentation is archived and is not being maintained.

Service.Extensions الخاصية

Visual Studio 2010

يحصل على مجموعة عناصر التوافق مع البرامج الخارجية المقترنة Service.

مساحة الاسم:  System.Web.Services.Description
التجميع:  System.Web.Services (في System.Web.Services.dll)

public override ServiceDescriptionFormatExtensionCollection Extensions { get; }


ServiceDescription myServiceDescription = 
   ServiceDescription.Read("MathService_CS.wsdl");
ServiceCollection myServiceCollection = 
   myServiceDescription.Services;

int noOfServices = myServiceCollection.Count;
Console.WriteLine("\nTotal number of services: " + noOfServices);

// Get a reference to the service.
Service myOldService = myServiceCollection[0];
Console.WriteLine("No. of Ports in the Service" + 
   myServiceCollection[0].Ports.Count);
Console.WriteLine("These are the ports in the service:");
for(int i = 0; i < myOldService.Ports.Count; i++)
   Console.WriteLine("Port name: " + myOldService.Ports[i].Name);
Console.WriteLine("Service name: " + myOldService.Name);

Service  myService = new Service();
myService.Name = "MathService";

// Add the ports to the newly created service.
for(int i = 0; i < myOldService.Ports.Count; i++)
{
   string PortName = myServiceCollection[0].Ports[i].Name;
   string BindingName = 
      myServiceCollection[0].Ports[i].Binding.Name;
   myService.Ports.Add(CreatePort(PortName, BindingName, 
      myServiceDescription.TargetNamespace));
}

Console.WriteLine("Newly created ports -");
for(int i = 0; i < myService.Ports.Count; i++)
   Console.WriteLine("Port Name: " + myOldService.Ports[i].Name);

// Add the extensions to the newly created service.
int noOfExtensions = myOldService.Extensions.Count;
Console.WriteLine("No. of extensions: " + noOfExtensions);
if (noOfExtensions > 0)
{
   for(int i = 0; i <myOldService.Ports.Count; i++)
      myService.Extensions.Add(
         myServiceCollection[0].Extensions[i]);
}

// Remove the service from the collection.
myServiceCollection.Remove(myOldService);

// Add the newly created service.
myServiceCollection.Add(myService);
myServiceDescription.Write("MathService_New.wsdl");


نظام التشغيل Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, الإصدار x64 من نظام التشغيل Windows XP Professional, Windows XP Starter Edition, Windows Server 2008, نظام التشغيل Windows Server 2003, نظام التشغيل Windows Server 2000 المزود بحزمة الخدمة SP4, نظام التشغيل Windows Millennium Edition, نظام التشغيل Windows 98

لا يدعم .NET Framework و .NET Compact Framework كافة الإصدارات الخاصة بكل نظام أساسي. للحصول على قائمة بالإصدارات المدعمة، راجع متطلبات النظام إطار عمل .NET.

.NET Framework

مدعوم في: 4, 3.5, 3.0, 2.0, 1.1, 1.0

NET Framework. Client Profile

مدعوم في: 4
إظهار: