本文整理汇总了C#中System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryServerFormatterSinkProvider.GetType方法的具体用法?C# BinaryServerFormatterSinkProvider.GetType怎么用?C# BinaryServerFormatterSinkProvider.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider
的用法示例。
在下文中一共展示了BinaryServerFormatterSinkProvider.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenuineUniversalServerTransportSink
/// <summary>
/// To avoid a problem inside MS code that can happen once per 380 thousand requests on multiCPU machines.
/// </summary>
static GenuineUniversalServerTransportSink()
{
// remove the damned pool
BinaryServerFormatterSinkProvider binaryServerFormatterSinkProvider = new BinaryServerFormatterSinkProvider();
Type coreChannelType = binaryServerFormatterSinkProvider.GetType().Assembly.GetType("System.Runtime.Remoting.Channels.CoreChannel");
Type byteBufferAllocator = binaryServerFormatterSinkProvider.GetType().Assembly.GetType("System.IO.ByteBufferAllocator");
FieldInfo _bufferPool = coreChannelType.GetField("_bufferPool", BindingFlags.NonPublic | BindingFlags.Static);
ConstructorInfo constructorInfo = byteBufferAllocator.GetConstructor(new Type[] { typeof(Int32) } );
_bufferPool.SetValue(null, constructorInfo.Invoke(new object[] { 0x1000 } ));
}
示例2: CreateTcpChannel
/// <summary>
/// Create a TcpChannel with a given name, on a given port.
/// </summary>
/// <param name="port"></param>
/// <param name="name"></param>
/// <returns></returns>
private static TcpChannel CreateTcpChannel( string name, int port, int limit )
{
ListDictionary props = new ListDictionary();
props.Add( "port", port );
props.Add( "name", name );
props.Add( "bindTo", "127.0.0.1" );
BinaryServerFormatterSinkProvider serverProvider =
new BinaryServerFormatterSinkProvider();
// NOTE: TypeFilterLevel and "clientConnectionLimit" property don't exist in .NET 1.0.
Type typeFilterLevelType = typeof(object).Assembly.GetType("System.Runtime.Serialization.Formatters.TypeFilterLevel");
if (typeFilterLevelType != null)
{
PropertyInfo typeFilterLevelProperty = serverProvider.GetType().GetProperty("TypeFilterLevel");
object typeFilterLevel = Enum.Parse(typeFilterLevelType, "Full");
typeFilterLevelProperty.SetValue(serverProvider, typeFilterLevel, null);
// props.Add("clientConnectionLimit", limit);
}
BinaryClientFormatterSinkProvider clientProvider =
new BinaryClientFormatterSinkProvider();
return new TcpChannel( props, clientProvider, serverProvider );
}
示例3: GetTcpChannel
public static TcpChannel GetTcpChannel( IDictionary properties )
{
BinaryServerFormatterSinkProvider serverProvider =
new BinaryServerFormatterSinkProvider();
// NOTE: The TypeFilterLevel enum/propety doesn't exist in .NET 1.0.
Type typeFilterLevelType = typeof(object).Assembly.GetType("System.Runtime.Serialization.Formatters.TypeFilterLevel");
if (typeFilterLevelType != null)
{
PropertyInfo typeFilterLevelProperty = serverProvider.GetType().GetProperty("TypeFilterLevel");
object typeFilterLevel = Enum.Parse(typeFilterLevelType, "Full");
typeFilterLevelProperty.SetValue(serverProvider, typeFilterLevel, null);
}
BinaryClientFormatterSinkProvider clientProvider =
new BinaryClientFormatterSinkProvider();
return new TcpChannel( properties, clientProvider, serverProvider );
}