コード例 #1
0
 internal static void RegisterTypes(ArrayList types)
 {
     foreach (object obj in types)
     {
         TypeEntry typeEntry = (TypeEntry)obj;
         if (typeEntry is ActivatedClientTypeEntry)
         {
             RemotingConfiguration.RegisterActivatedClientType((ActivatedClientTypeEntry)typeEntry);
         }
         else if (typeEntry is ActivatedServiceTypeEntry)
         {
             RemotingConfiguration.RegisterActivatedServiceType((ActivatedServiceTypeEntry)typeEntry);
         }
         else if (typeEntry is WellKnownClientTypeEntry)
         {
             RemotingConfiguration.RegisterWellKnownClientType((WellKnownClientTypeEntry)typeEntry);
         }
         else if (typeEntry is WellKnownServiceTypeEntry)
         {
             RemotingConfiguration.RegisterWellKnownServiceType((WellKnownServiceTypeEntry)typeEntry);
         }
     }
 }
コード例 #2
0
        public void ParseElement(string name, SmallXmlParser.IAttrList attrs)
        {
            if (currentProviderData != null)
            {
                ReadCustomProviderData(name, attrs);
                return;
            }

            switch (name)
            {
            case "application":
                ValidatePath(name, "system.runtime.remoting");
                if (attrs.Names.Length > 0)
                {
                    appName = attrs.Values[0];
                }
                break;

            case "lifetime":
                ValidatePath(name, "application");
                ReadLifetine(attrs);
                break;

            case "channels":
                ValidatePath(name, "system.runtime.remoting", "application");
                break;

            case "channel":
                ValidatePath(name, "channels");
                if (currentXmlPath.IndexOf("application") != -1)
                {
                    ReadChannel(attrs, false);
                }
                else
                {
                    ReadChannel(attrs, true);
                }
                break;

            case "serverProviders":
                ValidatePath(name, "channelSinkProviders", "channel");
                break;

            case "clientProviders":
                ValidatePath(name, "channelSinkProviders", "channel");
                break;

            case "provider":
            case "formatter":
                ProviderData prov;

                if (CheckPath("application/channels/channel/serverProviders") ||
                    CheckPath("channels/channel/serverProviders"))
                {
                    prov = ReadProvider(name, attrs, false);
                    currentChannel.ServerProviders.Add(prov);
                }
                else if (CheckPath("application/channels/channel/clientProviders") ||
                         CheckPath("channels/channel/clientProviders"))
                {
                    prov = ReadProvider(name, attrs, false);
                    currentChannel.ClientProviders.Add(prov);
                }
                else if (CheckPath("channelSinkProviders/serverProviders"))
                {
                    prov = ReadProvider(name, attrs, true);
                    RemotingConfiguration.RegisterServerProviderTemplate(prov);
                }
                else if (CheckPath("channelSinkProviders/clientProviders"))
                {
                    prov = ReadProvider(name, attrs, true);
                    RemotingConfiguration.RegisterClientProviderTemplate(prov);
                }
                else
                {
                    ValidatePath(name);
                }
                break;

            case "client":
                ValidatePath(name, "application");
                currentClientUrl = attrs.GetValue("url");
                break;

            case "service":
                ValidatePath(name, "application");
                break;

            case "wellknown":
                ValidatePath(name, "client", "service");
                if (CheckPath("client"))
                {
                    ReadClientWellKnown(attrs);
                }
                else
                {
                    ReadServiceWellKnown(attrs);
                }
                break;

            case "activated":
                ValidatePath(name, "client", "service");
                if (CheckPath("client"))
                {
                    ReadClientActivated(attrs);
                }
                else
                {
                    ReadServiceActivated(attrs);
                }
                break;

            case "soapInterop":
                ValidatePath(name, "application");
                break;

            case "interopXmlType":
                ValidatePath(name, "soapInterop");
                ReadInteropXml(attrs, false);
                break;

            case "interopXmlElement":
                ValidatePath(name, "soapInterop");
                ReadInteropXml(attrs, false);
                break;

            case "preLoad":
                ValidatePath(name, "soapInterop");
                ReadPreload(attrs);
                break;

            case "debug":
                ValidatePath(name, "system.runtime.remoting");
                break;

            case "channelSinkProviders":
                ValidatePath(name, "system.runtime.remoting");
                break;

            case "customErrors":
                ValidatePath(name, "system.runtime.remoting");
                RemotingConfiguration.SetCustomErrorsMode(attrs.GetValue("mode"));
                break;

            default:
                throw new RemotingException("Element '" + name + "' is not valid in system.remoting.configuration section");
            }
        }
コード例 #3
0
        public static void RegisterWellKnownClientType(Type type, string objectUrl)
        {
            WellKnownClientTypeEntry entry = new WellKnownClientTypeEntry(type, objectUrl);

            RemotingConfiguration.RegisterWellKnownClientType(entry);
        }
コード例 #4
0
 public static void Configure(string filename)
 {
     RemotingConfiguration.Configure(filename, false);
 }
コード例 #5
0
        public static void RegisterActivatedClientType(Type type, string appUrl)
        {
            ActivatedClientTypeEntry entry = new ActivatedClientTypeEntry(type, appUrl);

            RemotingConfiguration.RegisterActivatedClientType(entry);
        }
コード例 #6
0
        public static void RegisterWellKnownServiceType(Type type, string objectUri, WellKnownObjectMode mode)
        {
            WellKnownServiceTypeEntry entry = new WellKnownServiceTypeEntry(type, objectUri, mode);

            RemotingConfiguration.RegisterWellKnownServiceType(entry);
        }
コード例 #7
0
        public static void RegisterActivatedServiceType(Type type)
        {
            ActivatedServiceTypeEntry entry = new ActivatedServiceTypeEntry(type);

            RemotingConfiguration.RegisterActivatedServiceType(entry);
        }
コード例 #8
0
        public static void RegisterWellKnownClientType(Type type, String objectUrl)
        {
            WellKnownClientTypeEntry wke = new WellKnownClientTypeEntry(type, objectUrl);

            RemotingConfiguration.RegisterWellKnownClientType(wke);
        } // RegisterWellKnownClientType
コード例 #9
0
        public void ParseElement(string name, SmallXmlParser.IAttrList attrs)
        {
            if (this.currentProviderData != null)
            {
                this.ReadCustomProviderData(name, attrs);
                return;
            }
            if (name != null)
            {
                if (ConfigHandler.< > f__switch$map27 == null)
                {
                    ConfigHandler.< > f__switch$map27 = new Dictionary <string, int>(19)
                    {
                        {
                            "application",
                            0
                        },
                        {
                            "lifetime",
                            1
                        },
                        {
                            "channels",
                            2
                        },
                        {
                            "channel",
                            3
                        },
                        {
                            "serverProviders",
                            4
                        },
                        {
                            "clientProviders",
                            5
                        },
                        {
                            "provider",
                            6
                        },
                        {
                            "formatter",
                            6
                        },
                        {
                            "client",
                            7
                        },
                        {
                            "service",
                            8
                        },
                        {
                            "wellknown",
                            9
                        },
                        {
                            "activated",
                            10
                        },
                        {
                            "soapInterop",
                            11
                        },
                        {
                            "interopXmlType",
                            12
                        },
                        {
                            "interopXmlElement",
                            13
                        },
                        {
                            "preLoad",
                            14
                        },
                        {
                            "debug",
                            15
                        },
                        {
                            "channelSinkProviders",
                            16
                        },
                        {
                            "customErrors",
                            17
                        }
                    };
                }
                int num;
                if (ConfigHandler.< > f__switch$map27.TryGetValue(name, out num))
                {
                    switch (num)
                    {
                    case 0:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        if (attrs.Names.Length > 0)
                        {
                            this.appName = attrs.Values[0];
                        }
                        break;

                    case 1:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        this.ReadLifetine(attrs);
                        break;

                    case 2:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting",
                            "application"
                        });
                        break;

                    case 3:
                        this.ValidatePath(name, new string[]
                        {
                            "channels"
                        });
                        if (this.currentXmlPath.IndexOf("application") != -1)
                        {
                            this.ReadChannel(attrs, false);
                        }
                        else
                        {
                            this.ReadChannel(attrs, true);
                        }
                        break;

                    case 4:
                        this.ValidatePath(name, new string[]
                        {
                            "channelSinkProviders",
                            "channel"
                        });
                        break;

                    case 5:
                        this.ValidatePath(name, new string[]
                        {
                            "channelSinkProviders",
                            "channel"
                        });
                        break;

                    case 6:
                        if (this.CheckPath("application/channels/channel/serverProviders") || this.CheckPath("channels/channel/serverProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, false);
                            this.currentChannel.ServerProviders.Add(providerData);
                        }
                        else if (this.CheckPath("application/channels/channel/clientProviders") || this.CheckPath("channels/channel/clientProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, false);
                            this.currentChannel.ClientProviders.Add(providerData);
                        }
                        else if (this.CheckPath("channelSinkProviders/serverProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, true);
                            RemotingConfiguration.RegisterServerProviderTemplate(providerData);
                        }
                        else if (this.CheckPath("channelSinkProviders/clientProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, true);
                            RemotingConfiguration.RegisterClientProviderTemplate(providerData);
                        }
                        else
                        {
                            this.ValidatePath(name, new string[0]);
                        }
                        break;

                    case 7:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        this.currentClientUrl = attrs.GetValue("url");
                        break;

                    case 8:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        break;

                    case 9:
                        this.ValidatePath(name, new string[]
                        {
                            "client",
                            "service"
                        });
                        if (this.CheckPath("client"))
                        {
                            this.ReadClientWellKnown(attrs);
                        }
                        else
                        {
                            this.ReadServiceWellKnown(attrs);
                        }
                        break;

                    case 10:
                        this.ValidatePath(name, new string[]
                        {
                            "client",
                            "service"
                        });
                        if (this.CheckPath("client"))
                        {
                            this.ReadClientActivated(attrs);
                        }
                        else
                        {
                            this.ReadServiceActivated(attrs);
                        }
                        break;

                    case 11:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        break;

                    case 12:
                        this.ValidatePath(name, new string[]
                        {
                            "soapInterop"
                        });
                        this.ReadInteropXml(attrs, false);
                        break;

                    case 13:
                        this.ValidatePath(name, new string[]
                        {
                            "soapInterop"
                        });
                        this.ReadInteropXml(attrs, false);
                        break;

                    case 14:
                        this.ValidatePath(name, new string[]
                        {
                            "soapInterop"
                        });
                        this.ReadPreload(attrs);
                        break;

                    case 15:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        break;

                    case 16:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        break;

                    case 17:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        RemotingConfiguration.SetCustomErrorsMode(attrs.GetValue("mode"));
                        break;

                    default:
                        goto IL_512;
                    }
                    return;
                }
            }
IL_512:
            throw new RemotingException("Element '" + name + "' is not valid in system.remoting.configuration section");
        }
コード例 #10
0
 /// <summary>Registers a specified object type on the service end as a type that can be activated on request from a client.</summary>
 /// <param name="type">The <see cref="T:System.Type" /> of object to register. </param>
 /// <exception cref="T:System.Security.SecurityException">At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. </exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration" />
 /// </PermissionSet>
 public static void RegisterActivatedServiceType(Type type)
 {
     RemotingConfiguration.RegisterActivatedServiceType(new ActivatedServiceTypeEntry(type));
 }
コード例 #11
0
 /// <summary>Checks whether the object specified by its type name and assembly name is registered as a well-known client type.</summary>
 /// <returns>The <see cref="T:System.Runtime.Remoting.WellKnownClientTypeEntry" /> that corresponds to the specified object type.</returns>
 /// <param name="typeName">The type name of the object to check. </param>
 /// <param name="assemblyName">The assembly name of the object to check. </param>
 /// <exception cref="T:System.Security.SecurityException">At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. </exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration" />
 /// </PermissionSet>
 public static WellKnownClientTypeEntry IsWellKnownClientType(string typeName, string assemblyName)
 {
     return(RemotingConfiguration.IsWellKnownClientType(Assembly.Load(assemblyName).GetType(typeName)));
 }
コード例 #12
0
 /// <summary>Checks whether the object specified by its type name and assembly name is registered as a remotely activated client type.</summary>
 /// <returns>The <see cref="T:System.Runtime.Remoting.ActivatedClientTypeEntry" /> that corresponds to the specified object type.</returns>
 /// <param name="typeName">The type name of the object to check. </param>
 /// <param name="assemblyName">The assembly name of the object to check. </param>
 /// <exception cref="T:System.Security.SecurityException">At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. </exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration" />
 /// </PermissionSet>
 public static ActivatedClientTypeEntry IsRemotelyActivatedClientType(string typeName, string assemblyName)
 {
     return(RemotingConfiguration.IsRemotelyActivatedClientType(Assembly.Load(assemblyName).GetType(typeName)));
 }