Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. Connection Error

Connection Error

Scheduled Pinned Locked Moved WCF and WF
helpcsharpwcftutorialworkspace
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    muniratnam
    wrote on last edited by
    #1

    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

    E R 2 Replies Last reply
    0
    • M muniratnam

      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

      E Offline
      E Offline
      egenis
      wrote on last edited by
      #2

      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>

      Have a look here for more information[^]

      M 1 Reply Last reply
      0
      • M muniratnam

        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

        R Offline
        R Offline
        Ravi Mori
        wrote on last edited by
        #3

        This thing happened,when your service is not running. So be sure whether http://localhost/servicemodelsamples/service.svc is running or not.

        M 1 Reply Last reply
        0
        • E egenis

          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>

          Have a look here for more information[^]

          M Offline
          M Offline
          muniratnam
          wrote on last edited by
          #4

          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);

          E 1 Reply Last reply
          0
          • R Ravi Mori

            This thing happened,when your service is not running. So be sure whether http://localhost/servicemodelsamples/service.svc is running or not.

            M Offline
            M Offline
            muniratnam
            wrote on last edited by
            #5

            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);

            R 1 Reply Last reply
            0
            • M muniratnam

              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);

              R Offline
              R Offline
              Ravi Mori
              wrote on last edited by
              #6

              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

              M 1 Reply Last reply
              0
              • M muniratnam

                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);

                E Offline
                E Offline
                egenis
                wrote on last edited by
                #7

                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>

                1 Reply Last reply
                0
                • R Ravi Mori

                  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

                  M Offline
                  M Offline
                  muniratnam
                  wrote on last edited by
                  #8

                  Hi ravi, I have given http://localhost/servicemodelsamples/service/calculatorservice the same but the same error i am getting.... Regards Muni

                  R 1 Reply Last reply
                  0
                  • M muniratnam

                    Hi ravi, I have given http://localhost/servicemodelsamples/service/calculatorservice the same but the same error i am getting.... Regards Muni

                    R Offline
                    R Offline
                    Ravi Mori
                    wrote on last edited by
                    #9

                    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...

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups