Как настроить структуру URL-адресов API в оконной службе и как я могу звонить из веб-приложения?
Язык — C#. Ниже приведена текущая конфигурация маршрута API из службы окон.
`public WindowService()
{
InitializeComponent();
Код: Выделить всё
}
protected override void OnStart(string[] args)
{
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration("http://*:8085/");
HttpSelfHostServer server = null;
config.Routes.MapHttpRoute(
name: "API",
routeTemplate: "{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
server = new HttpSelfHostServer(config);
server.OpenAsync().Wait();
LogEvent("Service started.");
}
protected override void OnStop()
{
server.CloseAsync().Wait();
LogEvent("Service stopped.");
}`
Подробнее здесь: https://stackoverflow.com/questions/789 ... -on-server
Мобильная версия