Connection Error
-
Hi guys, I am new to the WCF environment i tried the basic example from msdn site... I have created Service and client .... But i am getting this error .. please help me somebody. An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll Additional information: Could not connect to http://localhost/servicemodelsamples/service.svc. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:80. thanks in advance Regs muni
-
Hi guys, I am new to the WCF environment i tried the basic example from msdn site... I have created Service and client .... But i am getting this error .. please help me somebody. An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll Additional information: Could not connect to http://localhost/servicemodelsamples/service.svc. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:80. thanks in advance Regs muni
Did you configure the service correctly? I have had some issues before where the config file was not set up correctly...
<system.serviceModel>
<services>
<service name = "MyNamespace.MyService">
<endpoint
address = "http://localhost:80/MyService/"
binding = "wsHttpBinding"
contract = "MyNamespace.IMyContract"
/>
</service>
</services>
</system.serviceModel> -
Hi guys, I am new to the WCF environment i tried the basic example from msdn site... I have created Service and client .... But i am getting this error .. please help me somebody. An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll Additional information: Could not connect to http://localhost/servicemodelsamples/service.svc. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:80. thanks in advance Regs muni
This thing happened,when your service is not running. So be sure whether http://localhost/servicemodelsamples/service.svc is running or not.
-
Did you configure the service correctly? I have had some issues before where the config file was not set up correctly...
<system.serviceModel>
<services>
<service name = "MyNamespace.MyService">
<endpoint
address = "http://localhost:80/MyService/"
binding = "wsHttpBinding"
contract = "MyNamespace.IMyContract"
/>
</service>
</services>
</system.serviceModel>Hi egenis, Thanks 4r ur reply. I am also cofigured the same as you told.But still i am getting the erorr. My full code like this nothing but i got it from msdn Service -------- Program.Cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.ServiceModel.Description; namespace Microsoft.ServiceModel.Samples { // Define a service contract. [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] public interface ICalculator { [OperationContract] double Add(double n1, double n2); [OperationContract] double Subtract(double n1, double n2); [OperationContract] double Multiply(double n1, double n2); [OperationContract] double Divide(double n1, double n2); } // Service class that implements the service contract. // Added code to write output to the console window. public class CalculatorService : ICalculator { public double Add(double n1, double n2) { double result = n1 + n2; Console.WriteLine("Received Add({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Subtract(double n1, double n2) { double result = n1 - n2; Console.WriteLine("Received Subtract({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Multiply(double n1, double n2) { double result = n1 * n2; Console.WriteLine("Received Multiply({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Divide(double n1, double n2) { double result = n1 / n2; Console.WriteLine("Received Divide({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } } class Program { static void Main(string[] args) { // Step 1 of the address configuration procedure: Create a URI to serve as the base address. Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service"); // Step 2 of the hosting procedure: Create ServiceHost ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);
-
This thing happened,when your service is not running. So be sure whether http://localhost/servicemodelsamples/service.svc is running or not.
Hi ravi, Thanks 4r ur reply. I am also cofigured the same as you told.But still i am getting the erorr. My full code like this nothing but i got it from msdn Service -------- Program.Cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.ServiceModel.Description; namespace Microsoft.ServiceModel.Samples { // Define a service contract. [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] public interface ICalculator { [OperationContract] double Add(double n1, double n2); [OperationContract] double Subtract(double n1, double n2); [OperationContract] double Multiply(double n1, double n2); [OperationContract] double Divide(double n1, double n2); } // Service class that implements the service contract. // Added code to write output to the console window. public class CalculatorService : ICalculator { public double Add(double n1, double n2) { double result = n1 + n2; Console.WriteLine("Received Add({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Subtract(double n1, double n2) { double result = n1 - n2; Console.WriteLine("Received Subtract({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Multiply(double n1, double n2) { double result = n1 * n2; Console.WriteLine("Received Multiply({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Divide(double n1, double n2) { double result = n1 / n2; Console.WriteLine("Received Divide({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } } class Program { static void Main(string[] args) { // Step 1 of the address configuration procedure: Create a URI to serve as the base address. Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service"); // Step 2 of the hosting procedure: Create ServiceHost ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);
-
Hi ravi, Thanks 4r ur reply. I am also cofigured the same as you told.But still i am getting the erorr. My full code like this nothing but i got it from msdn Service -------- Program.Cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.ServiceModel.Description; namespace Microsoft.ServiceModel.Samples { // Define a service contract. [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] public interface ICalculator { [OperationContract] double Add(double n1, double n2); [OperationContract] double Subtract(double n1, double n2); [OperationContract] double Multiply(double n1, double n2); [OperationContract] double Divide(double n1, double n2); } // Service class that implements the service contract. // Added code to write output to the console window. public class CalculatorService : ICalculator { public double Add(double n1, double n2) { double result = n1 + n2; Console.WriteLine("Received Add({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Subtract(double n1, double n2) { double result = n1 - n2; Console.WriteLine("Received Subtract({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Multiply(double n1, double n2) { double result = n1 * n2; Console.WriteLine("Received Multiply({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Divide(double n1, double n2) { double result = n1 / n2; Console.WriteLine("Received Divide({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } } class Program { static void Main(string[] args) { // Step 1 of the address configuration procedure: Create a URI to serve as the base address. Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service"); // Step 2 of the hosting procedure: Create ServiceHost ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);
you are getting me wrong there.. I am telling you to just confirm that the address where service is running is same as written in web.config file? In your code behind i found that: http://localhost:8000/ServiceModelSamples/Service/CalculatorService and in your web.config i found that: http://localhost/servicemodelsamples/service.svc
-
Hi egenis, Thanks 4r ur reply. I am also cofigured the same as you told.But still i am getting the erorr. My full code like this nothing but i got it from msdn Service -------- Program.Cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System.ServiceModel.Description; namespace Microsoft.ServiceModel.Samples { // Define a service contract. [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] public interface ICalculator { [OperationContract] double Add(double n1, double n2); [OperationContract] double Subtract(double n1, double n2); [OperationContract] double Multiply(double n1, double n2); [OperationContract] double Divide(double n1, double n2); } // Service class that implements the service contract. // Added code to write output to the console window. public class CalculatorService : ICalculator { public double Add(double n1, double n2) { double result = n1 + n2; Console.WriteLine("Received Add({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Subtract(double n1, double n2) { double result = n1 - n2; Console.WriteLine("Received Subtract({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Multiply(double n1, double n2) { double result = n1 * n2; Console.WriteLine("Received Multiply({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } public double Divide(double n1, double n2) { double result = n1 / n2; Console.WriteLine("Received Divide({0},{1})", n1, n2); Console.WriteLine("Return: {0}", result); return result; } } class Program { static void Main(string[] args) { // Step 1 of the address configuration procedure: Create a URI to serve as the base address. Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service"); // Step 2 of the hosting procedure: Create ServiceHost ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);
in the client code replace <pre>Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service");</pre> with <pre>Uri baseAddress = new Uri("http://localhost:8080/ServiceModelSamples/Service");</pre>
-
you are getting me wrong there.. I am telling you to just confirm that the address where service is running is same as written in web.config file? In your code behind i found that: http://localhost:8000/ServiceModelSamples/Service/CalculatorService and in your web.config i found that: http://localhost/servicemodelsamples/service.svc
Hi ravi, I have given http://localhost/servicemodelsamples/service/calculatorservice the same but the same error i am getting.... Regards Muni
-
Hi ravi, I have given http://localhost/servicemodelsamples/service/calculatorservice the same but the same error i am getting.... Regards Muni
http://localhost/servicemodelsamples/service/calculatorservice.svc you have to give .svc extension behind your service in your config as well as in code behind and also if you give port 8080(not 8000) in config then also provide it in code behind...