编程配置
在某些情况下,编程配置很有用。虽然配置文件在快速重定向而不重新编译应用程序时很有用,但也可以在宿主应用程序域和客户端域中直接配置远程类型。配置的常规要求在这里仍然适用。下面的代码示例显示一个侦听应用程序域的简单编程配置。
ChannelServices.RegisterChannel(New HttpChannel())
Dim WKSTE As New WellKnownServiceTypeEntry(GetType(ServiceClass), "HttpService", WellKnownObjectMode.SingleCall)
RemotingConfiguration.ApplicationName = "HttpService"
RemotingConfiguration.RegisterWellKnownServiceType(WKSTE)
ChannelServices.RegisterChannel(new HttpChannel());
WellKnownServiceTypeEntry WKSTE = new WellKnownServiceTypeEntry(typeof(ServiceClass),"HttpService", WellKnownObjectMode.SingleCall);
RemotingConfiguration.ApplicationName = "HttpService";
RemotingConfiguration.RegisterWellKnownServiceType(WKSTE);
在更复杂的方案中(如以编程方式发布远程对象的特定实例,然后从发布中移除该对象),必须使用此类型的配置。有关更多信息,请参见高级远程处理和远程处理示例:动态发布。
请参见
参考
RemotingConfiguration
ChannelServices