我正在.net WebSVC1和WebSVC2中编写两个Web服务。 WebSVC1的终点是WebSVC2,webSVC2的终点是webSVC1。 WebSVC1的目标框架是3.5,WebSVC2的目标框架是4.0,它们之间的调用如下所示。 在WebSVC1中:
//add service reference of websvc2 and create a proxy of webSVC2
WebSVC2 objSVC2=new WebSVC2()
SVC1_Method1()
{
objSVC2.method1_SVC2();
}
SVC1_Method2()
{
//general functionality
}
在WebSVC2中
//add service reference of websvc2 and create a proxy of webSVC2
WebSVC1 objSVC1=new WebSVC1()
objSVC2_Method2()
{
objSVC1.SVC1_Method2();
}
当我尝试从Web服务2调用Web服务1的SVC1_Method2()时,我得到以下异常。请尽快帮助我。
提前致谢。
System.ServiceModel.EndpointNotFoundException: Could not connect to TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:24066. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:24066 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() --- End of inner exception stack trace ---