나는 DuplexClientBase 생성자의 "endpointConfigurationName"매개 변수에 무엇을 지정해야합니까?DuplexClientBase 생성자의 "endpointConfigurationName"에 지정할 내용은 무엇입니까?
내가 무엇을 넣었는지에 관계없이 클라이언트는 이라는 실행을 throw합니다. "ServiceModel 클라이언트 구성 섹션에서 'ServiceReference1.IClientFulfillmentPipeService'계약을 참조하는 기본 끝점 요소를 찾을 수 없습니다. 이것은 응용 프로그램에 대한 구성 파일이 없기 때문일 수 있습니다 또는이 계약과 일치하는 끝점 요소가 클라이언트 요소에서 발견되지 않았기 때문입니다. "
"서비스 참조 추가"마법사를 사용하여 프록시를 생성했습니다. 다음은 클라이언트의 소스 코드입니다.
class Program
{
static void Main()
{
try
{
var client = new ClientFulfillmentPipeServiceClient(new InstanceContext(new Wrapper()), "*", "net.tcp://localhost:9000/svc");
client.Initialize(1234, "Test");
client.Close();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
}
그리고 샘플 WCF 서버는 콘솔 응용 프로그램으로 작성했습니다. 구현은 다음과 같습니다.
static void Main()
{
UiWcfSession.OnInitialize += ClientInitialize;
var baseAddresses = new Uri("net.tcp://localhost:9000/");
var host = new ServiceHost(typeof(UiWcfSession), baseAddresses);
var reliableSession = new ReliableSessionBindingElement { Ordered = true, InactivityTimeout = TimeSpan.MaxValue };
var binding =
new CustomBinding(reliableSession, new TcpTransportBindingElement()) { ReceiveTimeout = TimeSpan.MaxValue };
host.AddServiceEndpoint(typeof(IClientFulfillmentPipeService), binding, "svc");
var metadataBehavior = new ServiceMetadataBehavior();
host.Description.Behaviors.Add(metadataBehavior);
var mexBinding = MetadataExchangeBindings.CreateMexTcpBinding();
host.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding, "mex");
host.Open();
Thread.CurrentThread.Join();
}
private static void ClientInitialize(int uiprocessid, string key)
{
Debug.WriteLine("ClientInitialize");
}
XML 구성을 사용하고 있지 않습니다.
도와 주시겠습니까?