Tôi đang tìm ví dụ tối thiểu của WCF Named Pipes (Tôi hy vọng hai ứng dụng tối thiểu, máy chủ và máy khách, có thể giao tiếp thông qua một đường ống đặt tên.)WCF tên ống tối thiểu dụ
Microsoft có bài viết rực rỡ Getting Started Tutorial mô tả WCF qua HTTP, và tôi đang tìm kiếm một cái gì đó tương tự về WCF và tên ống.
Tôi đã tìm thấy một số bài đăng trên Internet, nhưng chúng hơi "nâng cao" một chút. Tôi cần một cái gì đó tối thiểu, chỉ có chức năng bắt buộc, vì vậy tôi có thể thêm mã của tôi và làm cho ứng dụng hoạt động.
Làm cách nào để thay thế điều đó để sử dụng một đường ống có tên?
<endpoint address="http://localhost:8000/ServiceModelSamples/Service/CalculatorService"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"
contract="ICalculator" name="WSHttpBinding_ICalculator">
<identity>
<userPrincipalName value="OlegPc\Oleg" />
</identity>
</endpoint>
Làm cách nào để thay thế để sử dụng một đường ống có tên?
// Step 1 of the address configuration procedure: Create a URI to serve as the base address.
Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/Service");
// Step 2 of the hosting procedure: Create ServiceHost
ServiceHost selfHost = new ServiceHost(typeof(CalculatorService), baseAddress);
try
{
// Step 3 of the hosting procedure: Add a service endpoint.
selfHost.AddServiceEndpoint(
typeof(ICalculator),
new WSHttpBinding(),
"CalculatorService");
// Step 4 of the hosting procedure: Enable metadata exchange.
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
selfHost.Description.Behaviors.Add(smb);
// Step 5 of the hosting procedure: Start (and then stop) the service.
selfHost.Open();
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.WriteLine();
Console.ReadLine();
// Close the ServiceHostBase to shutdown the service.
selfHost.Close();
}
catch (CommunicationException ce)
{
Console.WriteLine("An exception occurred: {0}", ce.Message);
selfHost.Abort();
}
Làm cách nào để tạo khách hàng sử dụng một đường ống có tên?
bạn đã xem http://stackoverflow.com/questions/184878/expose-a-wcf-service-through-a-named-pipes-binding chưa? –
vẫn không nhận được ... – javapowered