本文整理汇总了C#中System.Runtime.Remoting.Activation.RemotingXmlConfigFileData类的典型用法代码示例。如果您正苦于以下问题:C# RemotingXmlConfigFileData类的具体用法?C# RemotingXmlConfigFileData怎么用?C# RemotingXmlConfigFileData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RemotingXmlConfigFileData类属于System.Runtime.Remoting.Activation命名空间,在下文中一共展示了RemotingXmlConfigFileData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DelayLoadClientChannelEntry
internal DelayLoadClientChannelEntry(RemotingXmlConfigFileData.ChannelEntry entry, bool ensureSecurity)
{
this._entry = entry;
this._channel = null;
this._bRegistered = false;
this._ensureSecurity = ensureSecurity;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:DelayLoadClientChannelEntry.cs
示例2: ConfigureChannels
private static void ConfigureChannels(RemotingXmlConfigFileData configData, bool ensureSecurity)
{
RemotingServices.RegisterWellKnownChannels();
foreach (RemotingXmlConfigFileData.ChannelEntry entry in configData.ChannelEntries)
{
if (!entry.DelayLoad)
{
ChannelServices.RegisterChannel(CreateChannelFromConfigEntry(entry), ensureSecurity);
}
else
{
_delayLoadChannelConfigQueue.Enqueue(new DelayLoadClientChannelEntry(entry, ensureSecurity));
}
}
}
示例3: ConfigureRemoting
private static void ConfigureRemoting(RemotingXmlConfigFileData configData, bool ensureSecurity)
{
try
{
string applicationName = configData.ApplicationName;
if (applicationName != null)
{
ApplicationName = applicationName;
}
if (configData.CustomErrors != null)
{
_errorMode = configData.CustomErrors.Mode;
}
ConfigureChannels(configData, ensureSecurity);
if (configData.Lifetime != null)
{
if (configData.Lifetime.IsLeaseTimeSet)
{
LifetimeServices.LeaseTime = configData.Lifetime.LeaseTime;
}
if (configData.Lifetime.IsRenewOnCallTimeSet)
{
LifetimeServices.RenewOnCallTime = configData.Lifetime.RenewOnCallTime;
}
if (configData.Lifetime.IsSponsorshipTimeoutSet)
{
LifetimeServices.SponsorshipTimeout = configData.Lifetime.SponsorshipTimeout;
}
if (configData.Lifetime.IsLeaseManagerPollTimeSet)
{
LifetimeServices.LeaseManagerPollTime = configData.Lifetime.LeaseManagerPollTime;
}
}
_bUrlObjRefMode = configData.UrlObjRefMode;
Info.StoreRemoteAppEntries(configData);
Info.StoreActivatedExports(configData);
Info.StoreInteropEntries(configData);
Info.StoreWellKnownExports(configData);
if (configData.ServerActivatedEntries.Count > 0)
{
ActivationServices.StartListeningForRemoteRequests();
}
}
catch (Exception exception)
{
throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_ConfigurationFailure"), new object[] { exception }));
}
}
示例4: StoreActivatedExports
//
// XML Configuration Helper Functions
//
internal void StoreActivatedExports(RemotingXmlConfigFileData configData)
{
foreach (RemotingXmlConfigFileData.TypeEntry entry in configData.ServerActivatedEntries)
{
ActivatedServiceTypeEntry aste =
new ActivatedServiceTypeEntry(entry.TypeName, entry.AssemblyName);
aste.ContextAttributes =
CreateContextAttributesFromConfigEntries(entry.ContextAttributes);
RemotingConfiguration.RegisterActivatedServiceType(aste);
}
} // StoreActivatedExports
示例5: CreateChannelFromConfigEntry
[System.Security.SecurityCritical] // auto-generated
internal static IChannel CreateChannelFromConfigEntry(
RemotingXmlConfigFileData.ChannelEntry entry)
{
Type type = RemotingConfigInfo.LoadType(entry.TypeName, entry.AssemblyName);
bool isServerChannel = typeof(IChannelReceiver).IsAssignableFrom(type);
bool isClientChannel = typeof(IChannelSender).IsAssignableFrom(type);
IClientChannelSinkProvider clientProviderChain = null;
IServerChannelSinkProvider serverProviderChain = null;
if (entry.ClientSinkProviders.Count > 0)
clientProviderChain = CreateClientChannelSinkProviderChain(entry.ClientSinkProviders);
if (entry.ServerSinkProviders.Count > 0)
serverProviderChain = CreateServerChannelSinkProviderChain(entry.ServerSinkProviders);
// construct argument list
Object[] args;
if (isServerChannel && isClientChannel)
{
args = new Object[3];
args[0] = entry.Properties;
args[1] = clientProviderChain;
args[2] = serverProviderChain;
}
else
if (isServerChannel)
{
args = new Object[2];
args[0] = entry.Properties;
args[1] = serverProviderChain;
}
else
if (isClientChannel)
{
args = new Object[2];
args[0] = entry.Properties;
args[1] = clientProviderChain;
}
else
{
throw new RemotingException(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_InvalidChannelType"),
type.FullName));
}
IChannel channel = null;
try
{
channel = (IChannel)Activator.CreateInstance(type,
BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance,
null,
args,
null,
null);
}
catch (MissingMethodException)
{
String ctor = null;
if (isServerChannel && isClientChannel)
ctor = "MyChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)";
else
if (isServerChannel)
ctor = "MyChannel(IDictionary properties, IServerChannelSinkProvider serverSinkProvider)";
else
if (isClientChannel)
ctor = "MyChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider)";
throw new RemotingException(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_ChannelMissingCtor"),
type.FullName, ctor));
}
return channel;
} // CreateChannelFromEntry
示例6: ConfigureRemoting
[System.Security.SecurityCritical] // auto-generated
private static void ConfigureRemoting(RemotingXmlConfigFileData configData, bool ensureSecurity)
{
try
{
String appName = configData.ApplicationName;
if (appName != null)
ApplicationName = appName;
if (configData.CustomErrors != null)
_errorMode = configData.CustomErrors.Mode;
// configure channels
ConfigureChannels(configData, ensureSecurity);
// configure lifetime
if (configData.Lifetime != null)
{
if (configData.Lifetime.IsLeaseTimeSet)
LifetimeServices.LeaseTime = configData.Lifetime.LeaseTime;
if (configData.Lifetime.IsRenewOnCallTimeSet)
LifetimeServices.RenewOnCallTime = configData.Lifetime.RenewOnCallTime;
if (configData.Lifetime.IsSponsorshipTimeoutSet)
LifetimeServices.SponsorshipTimeout = configData.Lifetime.SponsorshipTimeout;
if (configData.Lifetime.IsLeaseManagerPollTimeSet)
LifetimeServices.LeaseManagerPollTime = configData.Lifetime.LeaseManagerPollTime;
}
_bUrlObjRefMode = configData.UrlObjRefMode;
// configure other entries
Info.StoreRemoteAppEntries(configData);
Info.StoreActivatedExports(configData);
Info.StoreInteropEntries(configData);
Info.StoreWellKnownExports(configData);
// start up activation listener if there are any activated objects exposed
if (configData.ServerActivatedEntries.Count > 0)
ActivationServices.StartListeningForRemoteRequests();
}
catch (Exception e)
{
throw new RemotingException(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString(
"Remoting_Config_ConfigurationFailure"),
e));
}
} // ConfigureRemoting
示例7: StoreRemoteAppEntries
} // StoreInteropEntries
internal void StoreRemoteAppEntries(RemotingXmlConfigFileData configData)
{
char[] slash = new char[]{'/'};
// add each remote app to the table
foreach (RemotingXmlConfigFileData.RemoteAppEntry remApp in configData.RemoteAppEntries)
{
// form complete application uri by combining specified uri with app-name
// (make sure appUri ends with slash, and that app name doesn't start,
// with one. then make sure that the combined form has no trailing slashes).
String appUri = remApp.AppUri;
if ((appUri != null) && !appUri.EndsWith("/", StringComparison.Ordinal))
appUri = appUri.TrimEnd(slash);
// add each client activated type for this remote app
foreach (RemotingXmlConfigFileData.TypeEntry cae in remApp.ActivatedObjects)
{
ActivatedClientTypeEntry acte =
new ActivatedClientTypeEntry(cae.TypeName, cae.AssemblyName,
appUri);
acte.ContextAttributes =
CreateContextAttributesFromConfigEntries(cae.ContextAttributes);
RemotingConfiguration.RegisterActivatedClientType(acte);
}
// add each well known object for this remote app
foreach (RemotingXmlConfigFileData.ClientWellKnownEntry cwke in remApp.WellKnownObjects)
{
WellKnownClientTypeEntry wke =
new WellKnownClientTypeEntry(cwke.TypeName, cwke.AssemblyName,
cwke.Url);
wke.ApplicationUrl = appUri;
RemotingConfiguration.RegisterWellKnownClientType(wke);
}
}
} // StoreRemoteAppEntries
示例8: ProcessClientNode
} // ProcessServiceNode
// appears under "application"
private static void ProcessClientNode(ConfigNode node, RemotingXmlConfigFileData configData)
{
String remoteAppUri = null;
// process attributes
foreach (DictionaryEntry entry in node.Attributes)
{
String key = entry.Key.ToString();
switch (key)
{
case "url": remoteAppUri = (String)entry.Value; break;
case "displayName": break; // displayName is ignored (used by config utility for labelling the application)
default: break;
} // switch
} // foreach attribute
RemotingXmlConfigFileData.RemoteAppEntry remoteApp =
configData.AddRemoteAppEntry(remoteAppUri);
// process child nodes
foreach (ConfigNode childNode in node.Children)
{
switch (childNode.Name)
{
case "wellknown": ProcessClientWellKnownNode(childNode, configData, remoteApp); break;
case "activated": ProcessClientActivatedNode(childNode, configData, remoteApp); break;
default: break;
} // switch
} // foreach child node
// if there are any activated entries, we require a remote app url.
if ((remoteApp.ActivatedObjects.Count > 0) && (remoteAppUri == null))
ReportMissingAttributeError(node, "url", configData);
} // ProcessClientNode
示例9: ProcessLifetimeNode
private static void ProcessLifetimeNode(ConfigNode parentNode, ConfigNode node, RemotingXmlConfigFileData configData)
{
if (configData.Lifetime != null)
ReportUniqueSectionError(node, parentNode, configData);
configData.Lifetime = new RemotingXmlConfigFileData.LifetimeEntry();
foreach (DictionaryEntry entry in node.Attributes)
{
String key = entry.Key.ToString();
switch (key)
{
case "leaseTime":
configData.Lifetime.LeaseTime = ParseTime((String)entry.Value, configData);
break;
case "sponsorshipTimeout":
configData.Lifetime.SponsorshipTimeout = ParseTime((String)entry.Value, configData);
break;
case "renewOnCallTime":
configData.Lifetime.RenewOnCallTime = ParseTime((String)entry.Value, configData);
break;
case "leaseManagerPollTime":
configData.Lifetime.LeaseManagerPollTime = ParseTime((String)entry.Value, configData);
break;
default: break;
} // switch
} // foreach
} // ProcessLifetimeNode
示例10: ReportMissingAttributeError
} // ReportUnknownValueError
private static void ReportMissingAttributeError(ConfigNode node, String attributeName,
RemotingXmlConfigFileData configData)
{
ReportMissingAttributeError(node.Name, attributeName, configData);
} // ReportMissingAttributeError
示例11: ReportUnknownValueError
} // ReportUniqueSectionError
private static void ReportUnknownValueError(ConfigNode node, String value,
RemotingXmlConfigFileData configData)
{
ReportError(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_UnknownValue"),
node.Name, value),
configData);
} // ReportUnknownValueError
示例12: ReportUniqueSectionError
} // ReportError
// means section must be unique
private static void ReportUniqueSectionError(ConfigNode parent, ConfigNode child,
RemotingXmlConfigFileData configData)
{
ReportError(
String.Format(
CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Config_NodeMustBeUnique"),
child.Name, parent.Name),
configData);
} // ReportUniqueSectionError
示例13: ReportError
} // ParseConfigFile
private static void ReportError(String errorStr, RemotingXmlConfigFileData configData)
{
// <
throw new RemotingException(errorStr);
} // ReportError
示例14: ParseConfigNode
private static RemotingXmlConfigFileData ParseConfigNode(ConfigNode rootNode)
{
RemotingXmlConfigFileData configData = new RemotingXmlConfigFileData();
// check to see if this file has a system.runtime.remoting section
if (rootNode == null)
return null;
// process attributes
foreach (DictionaryEntry entry in rootNode.Attributes)
{
String key = entry.Key.ToString();
switch (key)
{
case "version":
{
// we ignore the version attribute because this may be used
// by the configuration system
break;
}
default: break;
} // switch
} // foreach
ConfigNode appNode = null; // "application" node
ConfigNode channelsNode = null; // "channels" node
ConfigNode providerNode = null; // "channelSinkProviders" node
ConfigNode debugNode = null; // "debug" node
ConfigNode customErrorsNode = null; // "customErrors" node
foreach (ConfigNode node in rootNode.Children)
{
switch (node.Name)
{
case "application":
{
// there can only be one application node in a config file
if (appNode != null)
ReportUniqueSectionError(rootNode, appNode, configData);
appNode = node;
break;
} // case "application"
case "channels":
{
if (channelsNode != null)
ReportUniqueSectionError(rootNode, channelsNode, configData);
channelsNode = node;
break;
} // case "channels"
case "channelSinkProviders":
{
if (providerNode != null)
ReportUniqueSectionError(rootNode, providerNode, configData);
providerNode = node;
break;
} // case "channelSinkProviders"
case "debug":
{
if (debugNode != null)
ReportUniqueSectionError(rootNode, debugNode, configData);
debugNode = node;
break;
} // case "debug"
case "customErrors":
{
if (customErrorsNode != null)
ReportUniqueSectionError(rootNode, customErrorsNode, configData);
customErrorsNode = node;
break;
}// case "customErrors"
default: break;
} // switch
} // foreach
if (debugNode != null)
ProcessDebugNode(debugNode, configData);
if (providerNode != null)
ProcessChannelSinkProviderTemplates(providerNode, configData);
if (channelsNode != null)
ProcessChannelTemplates(channelsNode, configData);
if (appNode != null)
ProcessApplicationNode(appNode, configData);
if (customErrorsNode != null)
//.........这里部分代码省略.........
示例15: ParseTime
} // CheckAssemblyNameForVersionInfo
private static TimeSpan ParseTime(String time, RemotingXmlConfigFileData configData)
{
// time formats, e.g.
// 10D -> 10 days
// 10H -> 10 hours
// 10M -> 10 minutes
// 10S -> 10 seconds
// 10MS -> 10 milliseconds
// 10 -> default is seconds: 10 seconds
String specifiedTime = time;
String metric = "s"; // default is seconds
int metricLength = 0;
char lastChar = ' ';
if (time.Length > 0)
lastChar = time[time.Length - 1];
TimeSpan span = TimeSpan.FromSeconds(0);
try
{
if (!Char.IsDigit(lastChar))
{
if (time.Length == 0)
ReportInvalidTimeFormatError(specifiedTime, configData);
time = time.ToLower(CultureInfo.InvariantCulture);
metricLength = 1;
if (time.EndsWith("ms", StringComparison.Ordinal))
metricLength = 2;
metric = time.Substring(time.Length - metricLength, metricLength);
}
int value = Int32.Parse(time.Substring(0, time.Length - metricLength), CultureInfo.InvariantCulture);
switch (metric)
{
case "d": span = TimeSpan.FromDays(value); break;
case "h": span = TimeSpan.FromHours(value); break;
case "m": span = TimeSpan.FromMinutes(value); break;
case "s": span = TimeSpan.FromSeconds(value); break;
case "ms": span = TimeSpan.FromMilliseconds(value); break;
default:
{
ReportInvalidTimeFormatError(specifiedTime, configData);
break;
}
} // switch
}
catch (Exception)
{
ReportInvalidTimeFormatError(specifiedTime, configData);
}
return span;
} // ParseTime