개정판 664ea2e1
Markus에서 markusupdate를 변경하도록 수정
Change-Id: I4c2fe33f46732a9dc6b1fe683771c5acbcfd5d36
IIpc/WcfServer.cs | ||
---|---|---|
2 | 2 |
using System.Collections.Generic; |
3 | 3 |
using System.Linq; |
4 | 4 |
using System.ServiceModel; |
5 |
using System.ServiceModel.Channels; |
|
6 |
using System.ServiceModel.Description; |
|
5 | 7 |
using System.Text; |
6 | 8 |
using System.Threading.Tasks; |
9 |
using System.Xml; |
|
7 | 10 |
|
8 | 11 |
namespace IIpc |
9 | 12 |
{ |
10 | 13 |
public sealed class WcfServer : IIpcServer |
11 | 14 |
{ |
12 |
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] |
|
15 |
[ServiceBehavior(IncludeExceptionDetailInFaults = true,InstanceContextMode = InstanceContextMode.Single)]
|
|
13 | 16 |
private class _Server : IIpcClient |
14 | 17 |
{ |
15 | 18 |
private readonly WcfServer server; |
16 |
|
|
19 |
|
|
17 | 20 |
public _Server(WcfServer server) |
18 | 21 |
{ |
19 | 22 |
this.server = server; |
... | ... | |
59 | 62 |
/// <param name="endpoint">지정된 끝점으로 유일하게 통신한다.</param> |
60 | 63 |
public WcfServer(string endpoint) |
61 | 64 |
{ |
62 |
this.host = new ServiceHost(new _Server(this), new Uri(string.Format("net.pipe://localhost/{0}", endpoint))); |
|
65 |
try |
|
66 |
{ |
|
67 |
this.host = new ServiceHost(new _Server(this), new Uri(string.Format("net.pipe://localhost/{0}", endpoint))); |
|
68 |
|
|
69 |
//ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); |
|
70 |
//smb.HttpGetEnabled = false; |
|
71 |
//host.Description.Behaviors.Add(smb); |
|
72 |
|
|
73 |
//var endpoints = this.host.AddDefaultEndpoints(); |
|
74 |
//System.Diagnostics.Debug.WriteLine(endpoints); |
|
75 |
} |
|
76 |
catch (Exception ex) |
|
77 |
{ |
|
78 |
System.Diagnostics.Debug.WriteLine(ex); |
|
79 |
} |
|
80 |
//this.host = new ServiceHost(this, new Uri(string.Format("net.pipe://localhost"))); |
|
81 |
|
|
82 |
//ServiceMetadataBehavior mBehave = new ServiceMetadataBehavior(); |
|
83 |
//mBehave.HttpGetEnabled = false; |
|
84 |
//mBehave.HttpsGetEnabled = false; |
|
85 |
//this.host.Description.Behaviors.Add(mBehave); |
|
86 |
|
|
87 |
//if (endpoint != null) |
|
88 |
//{ |
|
89 |
// NetNamedPipeBinding binding = new NetNamedPipeBinding { TransferMode = TransferMode.Buffered }; |
|
90 |
|
|
91 |
// binding.CloseTimeout = new TimeSpan(0, 1, 0); |
|
92 |
// binding.ReceiveTimeout = new TimeSpan(0, 1, 0); |
|
93 |
// binding.SendTimeout = new TimeSpan(0, 1, 0); |
|
94 |
// binding.OpenTimeout = new TimeSpan(0, 1, 0); |
|
95 |
|
|
96 |
// binding.CreateBindingElements().Add(gBindingElement); |
|
97 |
|
|
98 |
// var httpEndpoint = this.host.AddServiceEndpoint(typeof(IIpcServer), binding, endpoint); |
|
99 |
//} |
|
63 | 100 |
} |
64 | 101 |
|
102 |
public static BinaryMessageEncodingBindingElement gBindingElement = new BinaryMessageEncodingBindingElement |
|
103 |
{ |
|
104 |
MaxReadPoolSize = Int16.MaxValue, |
|
105 |
MaxWritePoolSize = Int16.MaxValue, |
|
106 |
MaxSessionSize = Int16.MaxValue, |
|
107 |
ReaderQuotas = GetReaderQuotas() |
|
108 |
}; |
|
109 |
|
|
110 |
public static XmlDictionaryReaderQuotas GetReaderQuotas() |
|
111 |
{ |
|
112 |
return new XmlDictionaryReaderQuotas |
|
113 |
{ |
|
114 |
MaxDepth = Int16.MaxValue, |
|
115 |
MaxStringContentLength = Int16.MaxValue, |
|
116 |
MaxArrayLength = Int16.MaxValue, |
|
117 |
MaxBytesPerRead = Int16.MaxValue, |
|
118 |
MaxNameTableCharCount = Int16.MaxValue |
|
119 |
}; |
|
120 |
} |
|
121 |
|
|
122 |
|
|
65 | 123 |
public event EventHandler<IpcThumbnailEventArgs> IpcThumbnailReceived; |
66 | 124 |
public event EventHandler<IpcDownloadStatusArgs> IpcFileDownloadReceived; |
67 | 125 |
|
내보내기 Unified diff