You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
772 B
26 lines
772 B
using Microsoft.Owin.Hosting;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
using System.Web.Http.SelfHost;
|
|
|
|
namespace WcfControlMonitorWebLib
|
|
{
|
|
/// <summary>
|
|
/// WebApi 服务宿主程序
|
|
/// </summary>
|
|
public class WebHost1
|
|
{
|
|
/// <summary>
|
|
/// 启动
|
|
/// </summary>
|
|
public static Task Startup(string url)
|
|
{
|
|
var config = new HttpSelfHostConfiguration(url);
|
|
config.MapHttpAttributeRoutes();
|
|
config.MessageHandlers.Add(new CorsHandler());
|
|
config.Routes.MapHttpRoute("restful", "api/{controller}/{id}", new { id = RouteParameter.Optional });
|
|
var server = new HttpSelfHostServer(config);
|
|
return server.OpenAsync();
|
|
}
|
|
}
|
|
}
|