WCF 서비스를 만들고 콘솔을 통해 호스팅했습니다. 'net.tcp : //192.0.0.0 : 9100/ConsoleApplication3/커뮤니케이터 내가 다른 웹 응용 프로그램을 작성하려고 할 때하지만 콘솔을 통한 WCF 서비스 호스팅
메타 데이터 가 해결 될 수 없음을 참조가 포함
의주고 오류 서비스 참조를 추가합니다 .svc/mextcp '. net.tcp : //192.0.0.0 : 9100/ConsoleApplication3/Communicator.svc/mextcp에 연결할 수 없습니다. 연결 시도가 00 : 00 : 00.9843750 인 기간 동안 지속되었습니다. TCP 오류 코드 10061 : 대상 기계 이 적극적으로 192.0.0.0:9100을 거부했기 때문에 연결할 수 없습니다. 대상 컴퓨터가 적극적으로 거부했습니다. 192.0.0.0:9100 서비스가 현재 솔루션에 정의되어있는 경우 서비스를 빌드하고 서비스 참조를 다시 추가하십시오. 여기
코드입니다 :
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
try
{
using (ServiceHost host = new ServiceHost(typeof(Communicator)))
{
host.Open();
Console.WriteLine("Press <Enter> to terminate the Host application.");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
[ServiceContract]
public interface ICommunicator
{
[OperationContract]
string SayHello();
}
public class Communicator : ICommunicator
{
public string SayHello()
{
return "I am here";
}
}
을 그리고 여기에 구성입니다 :
<configuration>
<system.serviceModel>
<services>
<service name="ConsoleApplication3.Communicator" behaviorConfiguration="CommunicatorBehavior">
<!-- Service Endpoints -->
<endpoint address="ConsoleApplication3" binding="netTcpBinding"
contract="ConsoleApplication3.ICommunicator"/>
<!-- This Endpoint is used for genertaing the proxy for the client -->
<!-- To avoid disclosing metadata information, set the value below to false and
remove the metadata endpoint above before deployment -->
<endpoint address="mex" contract="IMetadataExchange" binding="mexTcpBinding" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9100/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CommunicatorBehavior">
<serviceMetadata httpGetEnabled="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
그래서 무엇이 주소가되어야합니까 'net.tcp : // localhost : 9100/mex '이긴하지만 여전히 같은 오류가 있습니다 – BreakHead
@BreakHead : 또는이 하나가 궁극적으로 갈 것 같습니다. :'net.tcp : //192.168.168.145 : 9100 /' –
고강도, 그래도 여전히 같은 오류 :( – BreakHead