저는 WCF를 처음 사용합니다. 간단한 자체 호스팅 서비스를 만들고 app.config
을 추가했지만 브라우저에 주소를 입력하면 서비스를 만들 때받는 서비스 페이지가 표시되지 않습니다. http://localhost:8067/WCFService
서비스를 실행할 때 표시되는대로 서비스를 표시하지 않습니다.브라우저에 url을 입력하면 자체 호스팅 WCF 서비스가 작동하지 않습니까?
그러나 public static void main
대신 app.config
에 기본 서비스를 추가하려고하면 잘 작동하지 않습니다. 아무도 나를 도울 수 있습니까?
<configuration>
<system.serviceModel>
<services>
<service name="SelfHostedWCFService.WCFService">
<endpoint
address="http://localhost:8067/WCFService"
binding="wsHttpBinding"
contract="SelfHostedWCFService.IWCFService">
</endpoint>
</service>
</services>
</system.serviceModel>
</configuration>
다음은 Program.cs
입니다 :
namespace SelfHostedWCFService
{
[ServiceContract]
interface IWCFService
{
[OperationContract]
int Add(int a, int b);
[OperationContract]
int Sub(int a, int b);
[OperationContract]
int Mul(int a, int b);
}
}
다음은 service.cs
입니다 :
static void Main(string[] args)
{
ServiceHost host = new ServiceHost(typeof(SelfHostedWCFService.WCFService));
host.Open();
Console.WriteLine("Server is Running...............");
Console.ReadLine();
}
에 따라 수동으로 추가 인터페이스 파일 다음
는수동으로 추가 app.config
파일입니다 수동으로 파일을 dded :
namespace SelfHostedWCFService
{
class WCFService:IWCFService
{
public int Add(int a, int b) { return (a + b); }
public int Sub(int a, int b) { return (a - b); }
public int Mul(int a, int b) { return (a * b); }
}
}
내 app.config
또는 다른 개념에 뭔가 문제인가?
감사합니다 ..... 메타 데이터 교환 및 기본 주소에 대한 엔드 포인트가 필요합니다. 그것은 일했다!! – Shilpa