00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Text;
00005 using System.ServiceModel;
00006 using System.ServiceModel.Description;
00007 using System.ServiceModel.Channels;
00008 using System.Xml;
00009
00010 namespace UtmConvert {
00011 class IpcService {
00012 ServiceHost serviceHost;
00013 string _status = "ok";
00014 ~IpcService() {
00015 serviceHost.Close();
00016 }
00017
00018 public IpcService() {
00019 Uri baseAddress = new Uri("http://localhost/UtmConvert/UtmConvertService");
00020 string address = "net.pipe://localhost/UtmConvert/UtmConvertService";
00021 serviceHost = new ServiceHost(typeof(UtmConvertService), baseAddress);
00022 try {
00023
00024 NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
00025 serviceHost.AddServiceEndpoint(typeof(IUtmConvertService), binding, address);
00026
00027
00028 ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
00029 smb.HttpGetEnabled = true;
00030 smb.HttpGetUrl = new Uri("http://localhost:8001/UtmConvert");
00031 serviceHost.Description.Behaviors.Add(smb);
00032 long maxBufferPoolSize = binding.MaxBufferPoolSize;
00033 int maxBufferSize = binding.MaxBufferSize;
00034 int maxConnections = binding.MaxConnections;
00035 long maxReceivedMessageSize = binding.MaxReceivedMessageSize;
00036 NetNamedPipeSecurity security = binding.Security;
00037 string scheme = binding.Scheme;
00038 XmlDictionaryReaderQuotas readerQuotas = binding.ReaderQuotas;
00039 BindingElementCollection bCollection = binding.CreateBindingElements();
00040 HostNameComparisonMode hostNameComparisonMode = binding.HostNameComparisonMode;
00041 bool TransactionFlow = binding.TransactionFlow;
00042 TransactionProtocol transactionProtocol = binding.TransactionProtocol;
00043 EnvelopeVersion envelopeVersion = binding.EnvelopeVersion;
00044 TransferMode transferMode = binding.TransferMode;
00045 serviceHost.Open();
00046 } catch (CommunicationException ce) {
00047 _status = ce.Message;
00048 serviceHost.Abort();
00049 }
00050 }
00051
00052
00053 }
00054 }