protected override void ProcessRecord() { base.ProcessRecord(); SPWebService contentService = SPWebService.ContentService; SPWcfServiceSettings wcfServiceSettings = new SPWcfServiceSettings(); wcfServiceSettings.ReaderQuotasMaxStringContentLength = ReaderQuotasMaxStringContentLength; wcfServiceSettings.ReaderQuotasMaxArrayLength = ReaderQuotasMaxArrayLength; wcfServiceSettings.ReaderQuotasMaxBytesPerRead = ReaderQuotasMaxBytesPerRead; wcfServiceSettings.MaxReceivedMessageSize = MaxReceivedMessageSize; contentService.WcfServiceSettings[ServiceName] = wcfServiceSettings; contentService.Update(); }
public static void UpdateCustomWCF() { SPWebService contentService = SPWebService.ContentService; SPWcfServiceSettings wcfServiceSettings = new SPWcfServiceSettings(); wcfServiceSettings.ReaderQuotasMaxStringContentLength = Int32.MaxValue; wcfServiceSettings.ReaderQuotasMaxArrayLength = Int32.MaxValue; wcfServiceSettings.ReaderQuotasMaxBytesPerRead = Int32.MaxValue; wcfServiceSettings.MaxReceivedMessageSize = Int32.MaxValue; // Note: "runtime.svc" must be in lowercase contentService.WcfServiceSettings.Remove("calendarservice.svc"); contentService.WcfServiceSettings.Remove("commonservice.svc"); contentService.WcfServiceSettings.Remove("departmentservice.svc"); contentService.WcfServiceSettings.Remove("employeeservice.svc"); contentService.WcfServiceSettings.Remove("shifttimeservice.svc"); contentService.WcfServiceSettings.Remove("shiftmanagementservice.svc"); contentService.WcfServiceSettings.Remove("changeshiftmanagementservice.svc"); contentService.WcfServiceSettings.Remove("overtimeservice.svc"); contentService.WcfServiceSettings.Remove("notoverTimemanagementservice.svc"); contentService.WcfServiceSettings.Remove("vehiclemanagementservice.svc"); contentService.WcfServiceSettings.Remove("leavemanagementservice.svc"); contentService.WcfServiceSettings.Remove("freightmanagementservice.svc"); contentService.WcfServiceSettings.Remove("businesstripmanagementservice.svc"); //contentService.WcfServiceSettings["calendarservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["commonservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["departmentservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["employeeservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["shifttimeservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["shiftmanagementservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["changeshiftmanagementservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["overtimeservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["notoverTimemanagementservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["vehiclemanagementservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["leavemanagementservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["freightmanagementservice.svc"] = wcfServiceSettings; //contentService.WcfServiceSettings["businesstripmanagementservice.svc"] = wcfServiceSettings; contentService.Update(true); }
static void ConfigureWebServiceQuotas(string webServiceName) { SPWcfServiceSettings settings = new SPWcfServiceSettings { MaxReceivedMessageSize = 2147483647, MaxBufferSize = 2147483647, OpenTimeout = TimeSpan.FromMinutes(5), CloseTimeout = TimeSpan.FromMinutes(5), ReceiveTimeout = TimeSpan.FromMinutes(5), ReaderQuotasMaxDepth = 2147483647, ReaderQuotasMaxStringContentLength = 2147483647, ReaderQuotasMaxArrayLength = 2147483647, ReaderQuotasMaxBytesPerRead = 2147483647, ReaderQuotasMaxNameTableCharCount = 2147483647, }; SPWebService contentService = SPWebService.ContentService; contentService.WcfServiceSettings[webServiceName] = settings; contentService.Update(); }
public static void ConfigureRemoteManagerTimeout(string service) { SPWebService contentService = SPWebService.ContentService; if (contentService.WcfServiceSettings.ContainsKey(service)) { SPWcfServiceSettings wcfServiceSettings = new SPWcfServiceSettings(); wcfServiceSettings.ReaderQuotasMaxStringContentLength = 10485760; wcfServiceSettings.ReaderQuotasMaxArrayLength = int.MaxValue; wcfServiceSettings.ReaderQuotasMaxBytesPerRead = 10485760; wcfServiceSettings.MaxReceivedMessageSize = 10485760; wcfServiceSettings.ReceiveTimeout = TimeSpan.FromMinutes(15); wcfServiceSettings.OpenTimeout = TimeSpan.FromMinutes(15); wcfServiceSettings.CloseTimeout = TimeSpan.FromMinutes(15); contentService.WcfServiceSettings[service.ToLower()] = wcfServiceSettings; contentService.Update(); } else { // TODO - Exception handling } }