本文整理汇总了C#中System.ServiceModel.Description.WsdlExporter.ExportEndpoints方法的典型用法代码示例。如果您正苦于以下问题:C# WsdlExporter.ExportEndpoints方法的具体用法?C# WsdlExporter.ExportEndpoints怎么用?C# WsdlExporter.ExportEndpoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Description.WsdlExporter
的用法示例。
在下文中一共展示了WsdlExporter.ExportEndpoints方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WsdlExporter
void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription serviceDescription,
ServiceHostBase serviceHostBase)
{
WsdlExporter wsdlExporter = new WsdlExporter();
wsdlExporter.ExportEndpoints(serviceDescription.Endpoints,
new XmlQualifiedName(serviceDescription.Name, serviceDescription.Namespace));
foreach (ChannelDispatcher cDispatcher in serviceHostBase.ChannelDispatchers)
foreach (EndpointDispatcher endpointDispatcher in cDispatcher.Endpoints)
endpointDispatcher.DispatchRuntime.MessageInspectors.Add(
new XsdValidationInspector(wsdlExporter.GeneratedXmlSchemas));
}
示例2: Trace
public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, System.ServiceModel.Description.ServiceDescription service)
{
if (DiagnosticUtility.ShouldTrace(type))
{
WsdlExporter exporter = new WsdlExporter();
string ns = "http://tempuri.org/";
XmlQualifiedName wsdlServiceQName = new XmlQualifiedName("comPlusService", ns);
exporter.ExportEndpoints(service.Endpoints, wsdlServiceQName);
System.Web.Services.Description.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[ns];
ComPlusServiceHostStartedServiceDetailsSchema schema = new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
}
}
示例3: Trace
public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ServiceDescription service)
{
if (DiagnosticUtility.ShouldTrace(type))
{
WsdlExporter exporter = new WsdlExporter();
string serviceNs = NamingHelper.DefaultNamespace;
XmlQualifiedName serviceQName = new XmlQualifiedName("comPlusService", serviceNs);
exporter.ExportEndpoints(service.Endpoints, serviceQName);
WsdlNS.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[serviceNs];
ComPlusServiceHostStartedServiceDetailsSchema record =
new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
}
}
示例4: Main
static void Main(string[] args)
{
ContractDescription contract = ContractDescription.GetContract(typeof(IOrderService));
EndpointAddress address1 = new EndpointAddress("http://127.0.0.1/orderservice");
EndpointAddress address2 = new EndpointAddress("net.tcp://127.0.0.1/orderservice");
ServiceEndpoint endpoint1 = new ServiceEndpoint(contract, new WS2007HttpBinding(), address1);
ServiceEndpoint endpoint2 = new ServiceEndpoint(contract, new NetTcpBinding(), address2);
XmlQualifiedName serviceName = new XmlQualifiedName("OrderService", "http://www.artech.com/services/");
WsdlExporter exporter = new WsdlExporter();
exporter.ExportEndpoints(new ServiceEndpoint[] { endpoint1, endpoint2 }, serviceName);
MetadataSet metadata = exporter.GetGeneratedMetadata();
using (XmlWriter writer = new XmlTextWriter("metadata.xml", Encoding.UTF8))
{
metadata.WriteTo(writer);
}
Process.Start("metadata.xml");
}
示例5: GetExportedMetadata
private static MetadataSet GetExportedMetadata(ServiceDescription serviceDescription)
{
Collection<ServiceEndpoint> endpoints = new Collection<ServiceEndpoint>();
foreach (var endpoint in serviceDescription.Endpoints)
{
if (endpoint.Contract.ContractType == typeof(IMetadataProvisionService))
{
continue;
}
ServiceEndpoint newEndpoint = new ServiceEndpoint(endpoint.Contract, endpoint.Binding, endpoint.Address);
newEndpoint.Name = endpoint.Name;
foreach (var behavior in endpoint.Behaviors)
{
newEndpoint.Behaviors.Add(behavior);
}
endpoints.Add(newEndpoint);
}
WsdlExporter exporter = new WsdlExporter();
XmlQualifiedName wsdlServiceQName = new XmlQualifiedName(serviceDescription.Name, serviceDescription.Namespace);
exporter.ExportEndpoints(endpoints, wsdlServiceQName);
MetadataSet metadata = exporter.GetGeneratedMetadata();
return metadata;
}