示例#1
0
      protected AppDomainHost(Type serviceType,AppDomain appDomain,PermissionSet permissions,Uri[] baseAddresses)
      {
         State = CommunicationState.Faulted;

         //Cannot grant service permissions the host does not have
         permissions.Demand();

         string assemblyName = Assembly.GetAssembly(typeof(ServiceHostActivator)).FullName;
         m_ServiceHostActivator = appDomain.CreateInstanceAndUnwrap(assemblyName,typeof(ServiceHostActivator).ToString()) as ServiceHostActivator;

         appDomain.SetPermissionsSet(permissions);

         m_ServiceHostActivator.CreateHost(serviceType,baseAddresses);

         State = CommunicationState.Created;
      }