与其它SuperSocket程序相同,启动代码同样也要写到程序的入口处,如 Windows Azure 的 WorkRole 项目的OnStart() 方法:

public override bool OnStart()

{

// Set the maximum number of concurrent connections

ServicePointManager.DefaultConnectionLimit = 100;

// For information on handling configuration changes

// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

m_Bootstrap = BootstrapFactory.CreateBootstrap();

if (!m_Bootstrap.Initialize())

{

Trace.WriteLine("Failed to initialize SuperSocket!", "Error");

return false;

}

var result = m_Bootstrap.Start();

switch (result)

{

case (StartResult.None):

Trace.WriteLine("No server is configured, please check you configuration!");

return false;

case (StartResult.Success):

Trace.WriteLine("The server has been started!");

break;

case (StartResult.Failed):

Trace.WriteLine("Failed to start SuperSocket server! Please check error log for more information!");

return false;

case (StartResult.PartialSuccess):

Trace.WriteLine("Some server instances were started successfully, but the others failed to start! Please check error log for more information!");

break;

}

return base.OnStart();

}

添加SuperSocket的启动代码到 Windows Azure 的 WorkRole 项目的更多相关文章

  1. 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序

    原文 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序 Jim ...

  2. Windows Azure入门教学系列 (八):使用Windows Azure Drive

    我们知道,由于云端的特殊性,通常情况下,对文件系统的读写建议使用Blob Storage来代替.这就产生了一个问题:对于一个已经写好的本地应用程序,其中使用了NTFS API对本地文件系统读写的代码是 ...

  3. Windows Azure一些小技巧集合

    我最近做了一个Windows Azure上面的项目,自己在做的过程中遇到了很多问题.有的是我自己摸索解决,有的是到网上寻找零碎的信息结合起来解决的.我感觉应当把某些解决方法集中一下,方便我以后查阅,也 ...

  4. 最全的Windows Azure学习教程汇总

    Windows Azure 是微软基于云计算的操作系统,能够为开发者提供一个平台,帮助开发可运行在云服务器.数据中心.Web 和 PC 上的应用程序. Azure 是一种灵活和支持互操作的平台,能够将 ...

  5. Windows Azure 社区新闻综述(#73 版)

    欢迎查看最新版本的每周综述,其中包含有关云计算和 Windows Azure的社区推动新闻.内容和对话. 以下是过去一周基于您的反馈汇集在一起的内容: 文章.视频和博客文章 ·   Windows A ...

  6. Windows Azure 微软公有云体验(二) 存储成本比较分析

    Windows Azure 微软公有云已经登陆中国有一段时间了,现在是处于试用阶段,Windows Azure的使用将会给管理信息系统的开发.运行.维护带来什么样的新体验呢? Windows Azur ...

  7. 年末促销 Windows Azure在线充值送微软商城硬件大礼包

    春节前充值,尽享云端体验, 缤纷好礼持续进行时.即日起至2015年2月13日, 充值1000元以上即享好礼.您可以查阅WindowsAzure 官网活动页面,即刻参与活动:http://www.win ...

  8. [SDK2.2]Windows Azure Storage (15) 使用WCF服务,将本地图片上传至Azure Storage (上) 服务器端代码

    <Windows Azure Platform 系列文章目录> 这几天工作上的内容,把项目文件和源代码拿出来给大家分享下. 源代码下载:Part1 Part2 Part3 我们在写WEB服 ...

  9. [SDK2.2]Windows Azure Storage (16) 使用WCF服务,将本地图片上传至Azure Storage (上) 客户端代码

    <Windows Azure Platform 系列文章目录> 前一章我们完成了服务器端的代码,并且已经发布到了Windows Azure云端. 本章我们将实现客户端的代码,客户端这里我们 ...

随机推荐

  1. vue自定义指令之拖动页面的元素

    此案例中,用到了鼠标事件onmousedown.onmousemove.onmouseup 源代码如下: <!doctype html><html lang="en&quo ...

  2. js中index()的四种经典用法111

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. bzoj 4198 [Noi2015]荷马史诗——哈夫曼树

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4198 学习一下哈夫曼树.https://www.cnblogs.com/Zinn/p/940 ...

  4. HDU - 1724 Ellipse 自适应辛普森模板

    OJ 题解传送门 //Achen #include<algorithm> #include<iostream> #include<cstring> #include ...

  5. 使用openpyxl模块时出现错误: zipfile.BadZipFile: File is not a zip file

    通过Pycharm工具新建一个xlsx文件. 再通过openpyxl模块读取该表时,报错: zipfile.BadZipFile: File is not a zip file 如下所示: 解决办法: ...

  6. LintCode刷题笔记--Longest Increasing Subsequence

    标签: 动态规划 描述: Given a sequence of integers, find the longest increasing subsequence (LIS). You code s ...

  7. ubuntu上制作应用程序的快捷图标启动

    最近在研究Go语言,对比了几种流行的IDE,发现GoLand是使用体验最好的,没有之一.这也印证了网友们常说的那句话“JetBrain出品,必属精品”. 在ubuntu环境下使用GoLand,直接到J ...

  8. vagrant up 时提示错误 cound not open file

    根据教程:https://laravel-china.org/docs/laravel-development-environment/5.5/development-environment-wind ...

  9. 解决Apache日志"internal dummy connection"方法

    最近查看服务器中apache日志,发现有大量的 OPTIONS * HTTP/1.0" 200 - "-" "Apache (internal dummy co ...

  10. 【JZOJ4810】【NOIP2016提高A组五校联考1】道路规划

    题目描述 输入 输出 样例输入 5 1 4 5 2 3 3 4 2 1 5 样例输出 3 数据范围 样例解释 解法 模型显然. 设第一列为a[],第二列为b[],f[i]为前i个数的最大答案. 顺序枚 ...