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.

Binding.Operations الخاصية

Visual Studio 2010

يحصل على مجموعة المواصفات الخاصة بتنسيقات بيانات و رسالة البروتوكولات المستالخدمة في إجراء معتمد من قبل الخدمة ويب XML.

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

public OperationBindingCollection Operations { get; }

يوضح المثال التالي النموذجي استخدم Operationsخاصية.


// Create OperationBindings for each of the operations defined in asmx file.
OperationBinding addOperationBinding = CreateOperationBinding("Add",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(addOperationBinding);
OperationBinding subtractOperationBinding = CreateOperationBinding("Subtract",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(subtractOperationBinding);
OperationBinding multiplyOperationBinding = CreateOperationBinding("Multiply",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(multiplyOperationBinding);
OperationBinding divideOperationBinding = CreateOperationBinding("Divide",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(divideOperationBinding);


...


// Used to create OperationBinding instances within 'Binding'.
public static OperationBinding CreateOperationBinding(string operation,string targetNamespace)
{
   // Create OperationBinding instance for operation.
   OperationBinding myOperationBinding = new OperationBinding();
   myOperationBinding.Name = operation;
   // Create InputBinding for operation.
   InputBinding myInputBinding = new InputBinding();
   SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
   mySoapBodyBinding.Use = SoapBindingUse.Literal;
   myInputBinding.Extensions.Add(mySoapBodyBinding);
   // Create OutputBinding for operation.
   OutputBinding myOutputBinding = new OutputBinding();
   myOutputBinding.Extensions.Add(mySoapBodyBinding);
   // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. 
   myOperationBinding.Input = myInputBinding;
   myOperationBinding.Output = myOutputBinding;
   // Create extensibility element for 'SoapOperationBinding'.
   SoapOperationBinding mySoapOperationBinding = new SoapOperationBinding();
   mySoapOperationBinding.Style = SoapBindingStyle.Document;
   mySoapOperationBinding.SoapAction = targetNamespace + operation;
   // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'.
   myOperationBinding.Extensions.Add(mySoapOperationBinding);
   return myOperationBinding;
}


نظام التشغيل 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
إظهار: