c# - There was no endpoint listening -


I am trying to host my own WCF and stay out of the app.config file. My wcf service is part of my wpf project host code.

  host = new service host (Typef (Service1), new URI ("http: //" + System.Net.Dns.GetHostName () + ": 8733 / databaseTransfer WcfServiceLibaryMethod / Service1 / ")); ServiceMetadataBehavior smb = host.Description.Behaviors.Find & lt; ServiceMetadataBehavior & gt; (); If (SMB == tap) {smb = new service data (;); } BasicHttpBinding q = New BasicHttpBinding (BasicHttpSecurityMode.None); Q.CloseTimeout = New TimeSpain (1, 1, 0); Q.OpenTimeout = New TimeSpain (1, 1, 0); Q.ReceiveTimeout = New TimeSpain (1, 1, 0); Q.SendTimeout = New TimeSpain (1, 1, 0); Q.AllowCookies = false; Q.BypassProxyOnLocal = false; Q.MaxBufferSize = 2147483646; Q.MaxBufferPoolSize = 2147483646; Q.MaxReceivedMessageSize = 2147483646; Q.ReaderQuotas.MaxArrayLength = 2147483646; Q.ReaderQuotas.MaxBytesPerRead = 2147483646; Q.ReaderQuotas.MaxDepth = 2147483646; Q.ReaderQuotas.MaxNameTableCharCount = 2147483646; Q.ReaderQuotas.MaxStringContentLength = 2147483646; Host.AddServiceEndpoint (typeof (IService1), q, ""); Smb.HttpGetEnabled = True; Smb.MetadataExporter.PolicyVersion = PolicyVersion.Default; Host.Description.Behaviors.Add (SMB); Host.AddServiceEndpoint (typeof (IService1), q, "http: //" + System.Net.Dns.GetHostName () + ": 8733 / DatabaseTransferWcfServiceLibaryMethod / Service1 /"); Host.AddServiceEndpoint (New UdpDiscoveryEndpoint ()); Host.Open ();   

I get an error in my client code.

  var ep = "http: //" + System.Net.Dns.GetHostName () + ": 8733 / database transfer WcfServiceLibaryMethod / Service1 /"; Var binding = new basic hddbidding (); Binding. Security.mode = Basic HTPSequipment mode.No; Binding.Sendimeout = new system Timespan (0, 1, 30); ChannelFactory & LT; IService1 & gt; WCFFactory = New Channel Fineer & lt; IService1 & gt; (Binding, New Endpoint Address (AP)); IService1 wcf = wcfFactory.CreateChannel (); System.Net.ServicePointManager.DefaultConnectionLimit = 200; Wcf.generateId (System.Environment.MachineName);   

I turned off my firewall, so this is not causing the error.

Any ideas where I have gone wrong.

View comments when I fix these two changes to everything

 <0> static zero main (string [] arg) {var host = new service host (typef (service1), new URI ("http: //" System.Net.Dns.GetHostName () + ": 8733 / database transfer WCFServiceLibaryMethod / Service1 / ")); ServiceMetadataBehavior smb = host.Description.Behaviors.Find & lt; ServiceMetadataBehavior & gt; (); If (SMB == tap) {smb = new service data (;); } BasicHttpBinding q = New BasicHttpBinding (BasicHttpSecurityMode.None); Q.CloseTimeout = New TimeSpain (1, 1, 0); Q.OpenTimeout = New TimeSpain (1, 1, 0); Q.ReceiveTimeout = New TimeSpain (1, 1, 0); Q.SendTimeout = New TimeSpain (1, 1, 0); Q.AllowCookies = false; Q.BypassProxyOnLocal = false; Q.MaxBufferSize = 2147483646; Q.MaxBufferPoolSize = 2147483646; Q.MaxReceivedMessageSize = 2147483646; Q.ReaderQuotas.MaxArrayLength = 2147483646; Q.ReaderQuotas.MaxBytesPerRead = 2147483646; Q.ReaderQuotas.MaxDepth = 2147483646; Q.ReaderQuotas.MaxNameTableCharCount = 2147483646; Q.ReaderQuotas.MaxStringContentLength = 2147483646; Host.AddServiceEndpoint (typeof (IService1), q, ""); Smb.HttpGetEnabled = True; Smb.MetadataExporter.PolicyVersion = PolicyVersion.Default; Host.Description.Behaviors.Add (SMB); // ADD ServiceDiscoveryBehavior host.Description.Behaviors.Add (New ServiceDiscoveryBehavior ()); // COMMENT this line host. AddServiceEndpoint (typeof (IService1), q, "http: //" + System.Net.Dns.GetHostName () + ": 8733 / DatabaseTransferWcfServiceLibaryMethod / Service1 /"); Host.AddServiceEndpoint (New UdpDiscoveryEndpoint ()); Host.Open (); Var ap = "http: //" + System.Net.Dns.GetHostName () + ": 8733 / database transfer freewIiWirelibari meth / service1"; Var binding = new basic hddbidding (); Binding. Security.mode = Basic HTPSequipment mode.No; Binding.Sendimeout = new system Timespan (0, 1, 30); ChannelFactory & LT; IService1 & gt; WCFFactory = New Channel Fineer & lt; IService1 & gt; (Binding, New Endpoint Address (AP)); IService1 wcf = wcfFactory.CreateChannel (); System.Net.ServicePointManager.DefaultConnectionLimit = 200; Console.WriteLine (wcf.GenerateId (System.Environment.MachineName)); }    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -