이전에 작업 표시 줄의 .asmx 서비스에서 실행중인 WCF 서비스를 콘솔 응용 프로그램으로 포장하려고했습니다.ServiceHost (Console App)에서 실행중인 WCF 서비스
class Program
{
static void Main(string[] args)
{
Uri uri = new Uri("http://localhost:5000");
using (ServiceHost host = new ServiceHost(typeof(CheckoutService), uri))
{
Console.WriteLine("Prepping CheckoutService server");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
host.Open();
Console.Clear();
Console.WriteLine("CheckoutService server up and running");
Console.WriteLine("Press Return to stop service at any point");
Console.ReadLine();
host.Close();
}
}
그러나 (서비스가 콘솔 응용 프로그램에 랩되기 전에 작업하는 데 사용)이 서비스를 받아야하는 클라이언트 응용 프로그램이 이제 충돌한다 : 여기
는 WCF 서비스를 포장하기위한 코드입니다 오류가있는 아웃 :There was no endpoint listening at http://localhost:5000/CheckoutService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
의 app.config에서이 클라이언트에 대한 엔드 포인트 구성은 다음과 같습니다
<endpoint
address="http://localhost:5000/CheckoutService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICheckoutService"
contract="CheckoutServiceServer.ICheckoutService" name="BasicHttpBinding_ICheckoutService" />
아마도 WCF 서비스를 호스팅하는 콘솔 프로젝트에 .config
파일의 일부 양식이 누락되었다고 생각하지만 잘못 될 수 있습니다!
캡틴이 싫어하는 것은 분명하지만 서비스가 실행되지 않는 것처럼 들립니다. – JayC
당신은 호스트를 열고, 콘솔을 지우고, 즉시 다시 호스트를 닫습니다. 호스트를 즉시 닫으면 서비스는 어떻게 작동되고 있습니까? –
그래, 나는 계속 열어 놓으 려던 Console.ReadLine()을 놓쳤다. 그러나 추가 한 후에도 나는 여전히 같은 문제를 겪고있다. – Moza