Как использовать ServiceHostFactory с несколькими привязками?
Это то, что я пробовал, и я продолжаю получать проблемы, одна за другой ошибка.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Web.Services.Description;
using System.ServiceModel.Description;
using System.ServiceModel.Channels;
namespace WcfService7
{
public class clsMyOwnServiceHost : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type t, Uri[] baseAddresses)
{
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
BasicHttpBinding basicbinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
WSHttpBinding wsbinding = new WSHttpBinding(SecurityMode.None);
ServiceHost host = new ServiceHost(t, baseAddresses);
foreach(Uri uri in baseAddresses)
{
host.AddServiceEndpoint(typeof(IService1), basicbinding, uri);
host.AddServiceEndpoint(typeof(IService1), wsbinding, uri);
host.AddServiceEndpoint(typeof(IService1), binding, uri);
}
return host;
}
}
}