public static CalcServiceApplication Create(string name, CalcService 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
            CalcServiceApplication serviceApplication = new CalcServiceApplication(name, service, appPool);
            serviceApplication.Update();

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

            return(serviceApplication);
        }
Ejemplo n.º 2
0
        private CalcServiceApplication CreateServiceApplication(CalcService service)
        {
            // create service app
            CalcServiceApplication serviceApp = CalcServiceApplication.Create(
                ServiceAppName.Text,
                service,
                ApplicationPoolSelection.GetOrCreateApplicationPool());

            serviceApp.Update();

            // start it if it isn't already started
            if (serviceApp.Status != SPObjectStatus.Online)
            {
                serviceApp.Status = SPObjectStatus.Online;
            }

            // configure service app endpoint
            serviceApp.AddServiceEndpoint(string.Empty, SPIisWebServiceBindingType.Http);
            serviceApp.Update(true);

            // now provision the service app
            serviceApp.Provision();
            return(serviceApp);
        }