惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
V
V2EX
Cloudbric
Cloudbric
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
量子位
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
K
Kaspersky official blog
博客园 - 【当耐特】
T
Tenable Blog
L
Lohrmann on Cybersecurity
The Cloudflare Blog
S
Schneier on Security
A
Arctic Wolf
Latest news
Latest news
C
Cyber Attacks, Cyber Crime and Cyber Security
罗磊的独立博客
T
The Exploit Database - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
小众软件
小众软件
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学
Simon Willison's Weblog
Simon Willison's Weblog
雷峰网
雷峰网
NISL@THU
NISL@THU
人人都是产品经理
人人都是产品经理
月光博客
月光博客
J
Java Code Geeks
V
Visual Studio Blog
S
Security Affairs
博客园 - Franky
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
H
Heimdal Security Blog
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
AWS News Blog
AWS News Blog
G
GRAHAM CLULEY
T
Troy Hunt's Blog
SecWiki News
SecWiki News
Spread Privacy
Spread Privacy
宝玉的分享
宝玉的分享
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 聂微东

博客园 - Yu

Illegal characters in path 依赖注入的 Singleton、Scoped、Transient vs2015 编译报错:The project references NuGet package(s) that are missing on this computer... discuz 迁移 uc_server 报错 The timeout period elapsed prior to completion of the operation or the server is not responding. 微信小程序笔记 xmlns 与 targetNamespace 的解释 Ubuntu64 apache2+lvs+Keepalived NPOI CellStyle 设置 mysql --initialize specified but the data directory has files in it select2 多选设置默认值 VS 2015 IDE 不支持 MS SQL 2000 生成 dbml Ajax 如何执行 Response.Redirect ng 发生 Error: ELOOP: too many symbolic links encountered... HtmlAgilityPack 使用 微信 oauth2 两次回调 EF 热加载 Winform/Asp.net vs2015 使用 Eazfuscator.NET 3.3 The requested page cannot be accessed because the related configuration data for the page is invalid.
jquery call cross-domain webapi owin self-host
Yu · 2017-09-01 · via 博客园 - Yu
<!DOCTYPE HTML>
<html LANG="cn">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>cross domain IE5-11</title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script>
         $(function(){
			$.support.cors = true; // support to IE5-11
			$.ajax({
				type: "GET",
				url: "http://xxx-services:8081/api/values/99",
				dataType: "json"
			}).done(function (data) {
				console.log(data);
			});
        });
    </script>
</head>
<body>
</body>
</html>

public class ValuesController : ApiController
{
        public async Task<string> Get(int id)
        {
            var info = string.Format("API CurrentThread:{0}", Thread.CurrentThread.ManagedThreadId);
            var infoTask = await GetCurrentThread();
            var infoTaskFinished = string.Format("After GetCurrentThread:{0}", Thread.CurrentThread.ManagedThreadId);
            return string.Format("{0},{1},{2},{3}", info, infoTask, infoTaskFinished, id);
        }

        private async Task<string> GetCurrentThread()
        {
            await Task.Delay(1500);
            return string.Format("Action CurrentThread:{0}", Thread.CurrentThread.ManagedThreadId);
        }
}
public class Startup
{
    public void Configuration(IAppBuilder MyApp)
    {
            HttpConfiguration config = new HttpConfiguration();
            config.Routes.MapHttpRoute(name: "DefaultApi", routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
       MyApp.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); MyApp.UseWebApi(config); } }
//window service hosting

public
class MyControllersService : ServiceHelper.BaseService { bool isstart = false; public MyControllersService() : base("MyControllersService", true) { } protected override void MyWork() { try { this.OutputLog("MyWork Start", this.ServiceName); string address = "http://xxx-services:8081/"; if(!isstart) { WebApp.Start<Startup>(url: address); isstart = true; this.OutputLog("Starting OWIN Host", this.ServiceName); } } catch (Exception err) { this.OutputLog(CommonHelper.CommonUnit.ExceptionMsg(err), this.ServiceName); throw; } finally { this.OutputLog("MyWork Stop", this.ServiceName); }     } }