나는 wcf를 배우고 샘플 예제로 작업 중이다. 이것에서, 나는 wcf 서비스를위한 dll과 서비스와 다른 클라이언트 appn을 호스팅하기위한 2 개의 윈도우 애플리케이션을 만들었다. appn 호스팅에서 servicehost.open 메서드 다음에 코드를 실행할 수 없습니다. 나는 무슨 일이 일어나고 있는지 궁금해. 도와주세요.servicehost.open 메서드가 실행되지 않는 코드
호스팅 APPN의 코드는 다음과 같습니다 :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using System.ServiceModel.Description;
using WCFService;
namespace WCFServiceHost
{
public partial class Form1 : Form
{
ServiceHost sh = null;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Uri tcpa = new Uri("net.tcp://localhost:8000/TcpBinding");
sh = new ServiceHost(typeof(ServiceClass), tcpa);
NetTcpBinding tcpb = new NetTcpBinding();
ServiceMetadataBehavior mBehave = new ServiceMetadataBehavior();
sh.Description.Behaviors.Add(mBehave);
sh.AddServiceEndpoint(typeof(IMetadataExchange),
MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
sh.AddServiceEndpoint(typeof(IServiceClass), tcpb, tcpa);
sh.Open();
**//This line is not executed
label1.Text = "Service Running";
//This line is not executed**
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
sh.Close();
}
}
}
하나 더 도움 : 2005
왜 그 행을 실행할 수 없습니까? 서비스를 시작할 때 예외가 있습니까? 이게 뭐야? –
안녕하세요, Maciej 전 excepiton 로그를 복사했습니다. 아래 문의 사항을 확인하십시오. – chaitanyat
이미 포트 8000에서 청취하고있는 것이 없습니까? – BugFinder