public static BaristaServiceApplication Create(string name, BaristaService service, SPIisWebServiceApplicationPool appPool)
        {
            #region validation
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }
            if (appPool == null)
            {
                throw new ArgumentNullException("appPool");
            }
            #endregion

            // create the service application
            var serviceApplication = new BaristaServiceApplication(name, service, appPool);
            serviceApplication.Update();

            // register the supported endpoints
            serviceApplication.AddServiceEndpoint("http", SPIisWebServiceBindingType.Http);
            serviceApplication.AddServiceEndpoint("https", SPIisWebServiceBindingType.Https, "secure");

            return(serviceApplication);
        }
Exemplo n.º 2
0
        public SPServiceApplication CreateApplication(string name, Type serviceApplicationType, SPServiceProvisioningContext provisioningContext)
        {
            if (serviceApplicationType != typeof(BaristaServiceApplication))
            {
                throw new NotSupportedException();
            }

            if (provisioningContext == null)
            {
                throw new ArgumentNullException("provisioningContext");
            }

            // if the service doesn't already exist, create it
            var serviceApp = Farm.GetObject(name, Id, serviceApplicationType) as BaristaServiceApplication ??
                             BaristaServiceApplication.Create(name, this, provisioningContext.IisWebServiceApplicationPool);

            return(serviceApp);
        }