本文整理汇总了C#中System.ServiceModel.Description.ServiceEndpoint类的典型用法代码示例。如果您正苦于以下问题:C# ServiceEndpoint类的具体用法?C# ServiceEndpoint怎么用?C# ServiceEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceEndpoint类属于System.ServiceModel.Description命名空间,在下文中一共展示了ServiceEndpoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportEndpointTest
public void ExportEndpointTest ()
{
WsdlExporter we = new WsdlExporter ();
ServiceEndpoint se = new ServiceEndpoint (ContractDescription.GetContract (typeof (IEchoService)));
se.Binding = new BasicHttpBinding ();
se.Address = new EndpointAddress ("http://localhost:8080");
//TEST Invalid name: 5se.Name = "Service#1";
//se.Name = "Service0";
//se.ListenUri = new Uri ("http://localhost:8080/svc");
we.ExportEndpoint (se);
MetadataSet ms = we.GetGeneratedMetadata ();
Assert.AreEqual (6, ms.MetadataSections.Count);
CheckContract_IEchoService (ms, "#eet01");
WSServiceDescription sd = GetServiceDescription (ms, "http://tempuri.org/", "ExportEndpointTest");
CheckServicePort (GetService (sd, "service", "ExportEndpointTest"),
"BasicHttpBinding_IEchoService", new XmlQualifiedName ("BasicHttpBinding_IEchoService", "http://tempuri.org/"),
"http://localhost:8080/", "#eet02");
CheckBasicHttpBinding (sd, "BasicHttpBinding_IEchoService", new XmlQualifiedName ("IEchoService", "http://myns/echo"),
"Echo", "http://myns/echo/IEchoService/Echo", true, true, "#eet03");
}
示例2: ExportPolicy
protected internal PolicyConversionContext ExportPolicy(ServiceEndpoint endpoint)
{
Contract.Requires(endpoint != null);
Contract.Ensures(Contract.Result<System.ServiceModel.Description.PolicyConversionContext>() != null);
return default(PolicyConversionContext);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.ServiceModel.Description.MetadataExporter.cs
示例3: BuildProxyBehavior
internal static ClientRuntime BuildProxyBehavior(ServiceEndpoint serviceEndpoint, out BindingParameterCollection parameters)
{
parameters = new BindingParameterCollection();
SecurityContractInformationEndpointBehavior.ClientInstance.AddBindingParameters(serviceEndpoint, parameters);
AddBindingParameters(serviceEndpoint, parameters);
ContractDescription contractDescription = serviceEndpoint.Contract;
ClientRuntime clientRuntime = new ClientRuntime(contractDescription.Name, contractDescription.Namespace);
clientRuntime.ContractClientType = contractDescription.ContractType;
IdentityVerifier identityVerifier = serviceEndpoint.Binding.GetProperty<IdentityVerifier>(parameters);
if (identityVerifier != null)
{
clientRuntime.IdentityVerifier = identityVerifier;
}
for (int i = 0; i < contractDescription.Operations.Count; i++)
{
OperationDescription operation = contractDescription.Operations[i];
if (!operation.IsServerInitiated())
{
DispatcherBuilder.BuildProxyOperation(operation, clientRuntime);
}
else
{
DispatcherBuilder.BuildDispatchOperation(operation, clientRuntime.CallbackDispatchRuntime);
}
}
DispatcherBuilder.ApplyClientBehavior(serviceEndpoint, clientRuntime);
return clientRuntime;
}
示例4: ApplyClientBehavior
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
if (clientRuntime != null && clientRuntime.CallbackDispatchRuntime != null && clientRuntime.CallbackDispatchRuntime.UnhandledDispatchOperation != null)
{
clientRuntime.CallbackDispatchRuntime.UnhandledDispatchOperation.Invoker = new UnhandledActionOperationInvoker();
}
}
示例5: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
foreach (var operation in endpoint.Contract.Operations.Where(o => Methods.Contains(o.Name)))
{
operation.Behaviors.Find<DataContractSerializerOperationBehavior>().DataContractSurrogate = new JavascriptCallbackSurrogate(callbackFactory);
}
}
示例6: ApplyClientBehavior
/// <summary>
///
/// </summary>
/// <param name="contractDescription"></param>
/// <param name="endpoint"></param>
/// <param name="clientRuntime"></param>
public void ApplyClientBehavior(
ContractDescription contractDescription,
ServiceEndpoint endpoint,
ClientRuntime clientRuntime)
{
// empty
}
示例7: ApplyClientBehavior
/// <summary>
/// Injects the user agent into the service request.
/// </summary>
/// <param name="endpoint">The enpoint of the service for which to set the user-agent.</param>
/// <param name="clientRuntime">The client runtime.</param>
public override void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
base.ApplyClientBehavior(endpoint, clientRuntime);
CookieMessageInspector cmiInspector = new CookieMessageInspector(m_dicAuthenticationCookies);
clientRuntime.MessageInspectors.Add(cmiInspector);
}
示例8: ValidateEndpoint
void IEndpointBehavior.Validate(ServiceEndpoint endpoint)
{
if (endpoint == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoint");
ValidateEndpoint(endpoint);
}
示例9: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, DispatchRuntime dispatchRuntime)
{
var behavior =
dispatchRuntime.ChannelDispatcher.Host.Description.FindBehavior
<WebAuthenticationConfigurationBehavior,
WebAuthenticationConfigurationAttribute>(b => b.BaseBehavior);
if (behavior == null)
behavior = contractDescription.FindBehavior
<WebAuthenticationConfigurationBehavior,
WebAuthenticationConfigurationAttribute>(b => b.BaseBehavior);
if (behavior == null)
throw new ServiceAuthenticationConfigurationMissingException();
var authorizationBehavior =
dispatchRuntime.ChannelDispatcher.Host.Description.FindBehavior
<WebAuthorizationConfigurationBehavior,
WebAuthorizationConfigurationAttribute>(b => b.BaseBehavior);
Type authorizationPolicy = null;
if (authorizationBehavior != null)
authorizationPolicy = authorizationBehavior.AuthorizationPolicyType;
foreach (var endpointDispatcher in dispatchRuntime.ChannelDispatcher.Endpoints)
endpointDispatcher.DispatchRuntime.MessageInspectors.Add(
new ServiceAuthenticationInspector(
behavior.ThrowIfNull().AuthenticationHandler,
behavior.UsernamePasswordValidatorType,
behavior.RequireSecureTransport,
behavior.Source,
authorizationPolicy));
}
示例10: MethodInfoOperationSelector
void IContractBehavior.ApplyDispatchBehavior(ContractDescription description, ServiceEndpoint endpoint, DispatchRuntime dispatch)
{
if (dispatch.ClientRuntime != null)
{
dispatch.ClientRuntime.OperationSelector = new MethodInfoOperationSelector(description, MessageDirection.Output);
}
}
示例11: GetRequestClientFormatter
protected override IClientMessageFormatter GetRequestClientFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint)
{
if (operationDescription.Behaviors.Find<WebGetAttribute>() != null)
{
// no change for GET operations
return base.GetRequestClientFormatter(operationDescription, endpoint);
}
else
{
WebInvokeAttribute wia = operationDescription.Behaviors.Find<WebInvokeAttribute>();
if (wia != null)
{
if (wia.Method == "HEAD")
{
// essentially a GET operation
return base.GetRequestClientFormatter(operationDescription, endpoint);
}
}
}
if (operationDescription.Messages[0].Body.Parts.Count == 0)
{
// nothing in the body, still use the default
return base.GetRequestClientFormatter(operationDescription, endpoint);
}
return new NewtonsoftJsonClientFormatter(operationDescription, endpoint);
}
示例12: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
foreach (var operation in endpointDispatcher.DispatchRuntime.Operations)
{
operation.CallContextInitializers.Add(_callContextInitializer);
}
}
示例13: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
foreach (var errorHandler in errorHandlers)
{
endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(errorHandler);
}
}
示例14: ApplyClientBehavior
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
foreach (var errorHandler in errorHandlers)
{
clientRuntime.CallbackDispatchRuntime.ChannelDispatcher.ErrorHandlers.Add(errorHandler);
}
}
示例15: OrationiSlave
public OrationiSlave()
{
Binding binding = new NetTcpBinding(SecurityMode.None);
EndpointAddress defaultEndpointAddress = new EndpointAddress("net.tcp://localhost:57344/Orationi/Master/v1/");
EndpointAddress discoveredEndpointAddress = DiscoverMaster();
ContractDescription contractDescription = ContractDescription.GetContract(typeof(IOrationiMasterService));
ServiceEndpoint serviceEndpoint = new ServiceEndpoint(contractDescription, binding, discoveredEndpointAddress ?? defaultEndpointAddress);
var channelFactory = new DuplexChannelFactory<IOrationiMasterService>(this, serviceEndpoint);
try
{
channelFactory.Open();
}
catch (Exception ex)
{
channelFactory?.Abort();
}
try
{
_masterService = channelFactory.CreateChannel();
_communicationObject = (ICommunicationObject)_masterService;
_communicationObject.Open();
}
catch (Exception ex)
{
if (_communicationObject != null && _communicationObject.State == CommunicationState.Faulted)
_communicationObject.Abort();
}
}