Je vyžadována podpora jazyka JavaScript
Některé stránky na tomto webu vyžadují podporu jazyka JavaScript. Váš webový prohlížeč jazyk JavaScript nepodporuje nebo jazyk JavaScript není povolen.
Chcete-li zjistit, zda webový prohlížeč podporuje jazyk JavaScript nebo jazyk JavaScript chcete povolit, přečtěte si nápovědu k vašemu webovému prohlížeči.
NotificationServiceHostFactory.cs
Download fileToto je zdrojový kód souboru NotificationServiceHostFactory.cs
WCF Service host factory class for Silverlight Polling Duplex WCF NotificationService.
using System;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
namespace SilverlightDuplexSample.Web
{
public class NotificationServiceHostFactory : ServiceHostFactoryBase
{
public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses)
{
return new NotificationServiceHost(baseAddresses);
}
}
internal class NotificationServiceHost : ServiceHost
{
public NotificationServiceHost(params System.Uri[] addresses)
{
base.InitializeDescription(typeof(NotificationService), new UriSchemeKeyedCollection(addresses));
base.Description.Behaviors.Add(new ServiceMetadataBehavior() { HttpGetEnabled = true });
}
protected override void InitializeRuntime()
{
//Add an endpoint for the given service contract.
this.AddServiceEndpoint(typeof(INotificationService),
new PollingDuplexHttpBinding()
{
DuplexMode = PollingDuplexMode.MultipleMessagesPerPoll,
MaxOutputDelay = TimeSpan.FromSeconds(1)
},
"");
//this.AddServiceEndpoint(typeof(INotificationService),
// new CustomBinding(new PollingDuplexBindingElement() { DuplexMode = PollingDuplexMode.MultipleMessagesPerPoll, MaxOutputDelay = TimeSpan.FromSeconds(1) },
// new BinaryMessageEncodingBindingElement(),
// new HttpTransportBindingElement() { TransferMode = TransferMode.StreamedResponse }),
// "");
//Add a metadata endpoint.
this.AddServiceEndpoint(typeof(IMetadataExchange),
MetadataExchangeBindings.CreateMexHttpBinding(),
"mex");
base.InitializeRuntime();
}
}
}