/
AstroJohn
/
MailRobot
Обзор
Документация
Войти
/
AstroJohn
/
MailRobot
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
MailRobotLauncher/Program.cs
49 строк
1 KB
AstroJohn
1st commit
11 сен 2024, 13:31
11 сен 2024, 13:31
0f57dc5
Код
Авторство
О чём код?
using System; using System.Configuration; using System.ServiceModel; using System.ServiceModel.Description; using System.Xml; using MailRobot.WcfMailRobotService; class Program { static void Main(string[] args) { try { var httpBaseAddress = new Uri(ConfigurationManager.AppSettings["HttpBaseAddress"]); var binding = new BasicHttpBinding(); var quotas = new XmlDictionaryReaderQuotas { MaxArrayLength = 2147483647 }; binding.ReaderQuotas = quotas; var serviceHost = new ServiceHost(typeof(CheckLogService)); serviceHost.AddServiceEndpoint(typeof(ICheckLogService), binding, httpBaseAddress); var serviceBehavior = new ServiceMetadataBehavior { HttpGetEnabled = true, HttpGetUrl = httpBaseAddress }; serviceHost.Description.Behaviors.Add(serviceBehavior); serviceHost.Open(); Console.WriteLine($"Service is live now at: {httpBaseAddress}"); Console.ReadKey(); } catch (Exception ex) { Console.WriteLine($"There is an issue with CheckLogService: {ex.Message}"); Console.ReadKey(); } } }