using System;
using System.Web.Http;
using System.Web.Http.SelfHost; namespace UAC_OAuth2Center
{
public class Program
{
static void Main(string[] args)
{
try
{
var config = new HttpSelfHostConfiguration("http://localhost:2021");
// Web API 配置和服务
config.EnableCors(new System.Web.Http.Cors.EnableCorsAttribute("*", "*", "*", "*"));
//config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional });
using (var sever = new HttpSelfHostServer(config))
{
sever.OpenAsync().Wait();
Console.WriteLine("SPC_Server服务已经成功启动!");
Console.WriteLine("输入任意字符关闭");
Console.Read();
sever.CloseAsync().Wait(); }
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadKey();
}
}
}

记住,启动VS 的时候,使用管理员权限启动

最新文章

  1. 版本控制-svn服务器搭建和常用命令(centos 6.3)
  2. Linux 基本命令
  3. 传入任意json数据源进行格式化处理并用Angularjs显示
  4. About_MySQL Select--来自copy_03
  5. (五)socket实践编程
  6. viewpager的简单使用,以及ValueAnimator的用法示例
  7. 未能加载文件或程序集“Enyim.Caching”或它的某一个依赖项。未能验证强名称签名
  8. 异常捕捉 ( try catch finally ) 你真的掌握了吗?
  9. IntellijIdea中常用的快捷键
  10. Contest20140710 eagleeggs
  11. ASP.NET页面周期
  12. mpls vpn剩余笔记
  13. 【转】Wi-Fi 20mhz 和 40mhz 频段带宽的区别是什么?
  14. jQuery(二)、选择器
  15. python之路(五)-文件操作
  16. PHP 弹窗 源代码 css Jquery.js
  17. jquery正则表达式验证:验证身份证号码
  18. 查询yum包安装路径
  19. linux系统编程之文件与IO(一):文件描述符、open,close
  20. UVA12538 Version Controlled IDE

热门文章

  1. WPF 中如何变相让 ListBox 宽度(Width) 100%,高度(Height) 100%,从而达到 Filled 的效果
  2. 【LOJ#3146】[APIO2019]路灯(树套树)
  3. mongodb复杂条件查询 (or与and)
  4. 高性能TcpServer(C#) - 2.创建高性能Socket服务器SocketAsyncEventArgs的实现(IOCP)
  5. CSS常用布局方式-两列布局、三列布局
  6. 在vue项目中通过iframe引入jquery项目
  7. 基于JQuery可拖动列表格插件DataTables的踩坑记
  8. android studio学习----常用快捷键
  9. vue学习指南:第四篇(详细) - vue的 :class 和 :style
  10. GCN