How do I use WCF without specifying the uri/url/baseaddress? Is there anyway to make it automatically obtain these things?
I mean I wish to make it work like asp.net sites and webservices work where we don't mention the uri and stuff and it takes care of it by itself just as long as we configure it right in IIS. I need a similar solution on WCF.
Please help...
Thank you,.
Edit: Here's my server side code.I'm using a custom ServiceHostFactory here...
protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
BasicHttpBinding basichttpbinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
basichttpbinding.CloseTimeout=TimeSpan.MaxValue;
basichttpbinding.OpenTimeout=TimeSpan.MaxValue;
basichttpbinding.ReceiveTimeout=TimeSpan.MaxValue;
basichttpbinding.SendTimeout=TimeSpan.MaxValue;
// basichttpbinding.TransferMode = TransferMode.Buffered;
ServiceEndpoint servicepoint=new ServiceEndpoint(ContractDescription.GetContract(serviceType));
servicepoint.Binding=basichttpbinding;
ServiceHost servicehost = new ServiceHost(serviceType, baseAddresses);
((ServiceDebugBehavior)servicehost.Description.Behaviors[typeof(ServiceDebugBehavior)]).IncludeExceptionDetailInFaults=true;
servicehost.OpenTimeout = TimeSpan.MaxValue;
servicehost.CloseTimeout = TimeSpan.MaxValue;
servicepoint.Binding.SendTimeout = TimeSpan.MaxValue;
servicepoint.Binding.ReceiveTimeout = TimeSpan.MaxValue;
basichttpbinding.MaxBufferPoolSize = 999999999;
// basichttpbinding.MaxConnections = 999999999;
//basichttpbinding.MaxConnections = 999999999;
basichttpbinding.MaxReceivedMessageSize = 999999999;
XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas();
quotas.MaxArrayLength = 999999999;
quotas.MaxBytesPerRead = 999999999;
quotas.MaxDepth = 999999999;
quotas.MaxNameTableCharCount = 999999999;
quotas.MaxStringContentLength = 999999999;
basichttpbinding.ReaderQuotas = quotas;
//foreach (Uri uri in baseAddresses)
//{
servicehost.AddServiceEndpoint(typeof(IService), basichttpbinding, "http://localhost:52855/WCFService1/Service.svc");
// }
return servicehost;
}