No connection could be made because the target machine actively refused it?

后端 未结 28 2629
北荒
北荒 2020-11-22 01:27

Sometimes I get the following error while I was doing HttpWebRequest to a WebService. I copied my code below too.


System.Net.WebException: Unable to connect         


        
28条回答
  •  眼角桃花
    2020-11-22 01:53

    This happened to me too.. Sometimes when I open my project this error shown up which was frustrating. The problem was that sometimes the port-number of web service was changing unexpectedly.

    This problem usually happens when you have more than one copies of the project

    My project was calling the Web service with a specific port number which I assigned in the Web.Config file of my main project file. As the port number changed unexpectedly, the browser was unable to find the Web service and throwing that error.

    I solved this by following the below steps: (Visual Studio 2010)

    Go to Properties of the Web service project --> click on Web tab --> In Servers section --> Check Specific port and then assign the standard port number by which your main project is calling the web service.

    I hope this will solve the problem.

    Cheers :)

提交回复
热议问题