前两天看到了这篇文章,亲身体会了下,确实不错,按照官方的文档试了试本地部署,折腾一番后终于成功,记下心得在此,不敢独享。

本地部署官方wiki

  • .NET 4.6.1 这个因为我装了VS2015,就没有单独再装了
  • Java JDK 1.8+ 安装完后还需配置下Java环境,系统变量添加:JAVA_HOME  对应 C:\Program Files\Java\jdk1.8.0_102 是安装jdk的目录,用户变量Path 中添加 %JAVA_HOME%\bin; 配置完成后打开cmd,运行
    java -version 如果报错的话有很多种可能,搜索一下会有解决方案,我的就是在C:\Windows\System32 目录下把java.exe改名成javaa.exe,再次cmd运行就成功了
  • IIS 8+ 这个感觉不是强制的,我win7的IIS 7.5也是可以的
  • ElasticSearch 1.7.5 (Elasticsearch 2.x is not yet supported) 到连接地址去下载1.7.5版本,人家已经说明2.x的版本不支持,找这个历史版本得翻好几页,大概在第7页左右,直接给个下载连接:elasticsearch-1.7.5 ,下载完后解压
  • 下载最新的latest Exceptionless release artifact ZIP ,下载后解压,将目录中的elasticsearch.yml 复制到到elasticsearch的解压目录的bin目录中,执行elasticsearch目录中的elasticsearch.bat,看到最后一行有
    started 就说明成功了,打开http://localhost:9200/就能看到相关信息,如果es是部署服务的话复制到config目录中,执行
    service.bat install|remove|start|stop|manager
  • 在IIS中新建一个网站,路径选择Exceptionless解压目录中的wwwroot目录,端口这里可以自定义,比如用8004,应用程序池选4.0集成
  • 修改web.config中的ElasticSearchConnectionString为es的站点http://localhost:9200,修改<add key="BaseURL" value="http://localhost:8004/#" />,注意后面的"#"
  • 修改app.config.*.js中的.constant('BASE_URL', 'http://localhost:8004')
  • 打开http://localhost:8004 就能看到登录页面了,然后创建账户-->创建项目,比如创建一个控制台项目,这里就会提示怎么使用Exceptionless
  • ExceptionlessClient.Default.Startup("oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI"),这里的oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI就是api-key
  • 新建控制台项目,使用 NuGet  安装
    Install-Package Exceptionless

在Main中写测试代码:

//ExceptionlessClient.Default.Startup("qnN5lVebQ7LA94Erkthtkq5z57xX5Wg7ZzafiMdZ");
var client = new ExceptionlessClient(c => {
c.ApiKey = "oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI";
c.ServerUrl = "http://localhost:8004";
}); try
{
throw new Exception("test exception "+DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"));
}
catch (Exception ex)
{
client.SubmitException(ex);
//ex.ToExceptionless().Submit();
Console.WriteLine("error send");
}
Console.ReadKey();

这里需要注意注释掉的部分,或者是如下调用:

using Exceptionless.Configuration;
[assembly: Exceptionless("oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI", ServerUrl = "http://localhost:8004")]
namespace ExceptionTest
{
class Program
{
static void Main(string[] args)
{
ExceptionlessClient.Default.Startup("oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI");
//var client = new ExceptionlessClient(c => {
// c.ApiKey = "oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI";
// c.ServerUrl = "http://localhost:8004";
//});
try
{
throw new Exception("test exception "+DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"));
}
catch (Exception ex)
{
//client.SubmitException(ex);
ex.ToExceptionless().Submit();
Console.WriteLine("error send");
}
Console.ReadKey();
}
}
}

api-key指定两次,也可以通过。

使用config配置:

<configuration>
<configSections>
<section name="exceptionless" type="Exceptionless.ExceptionlessSection, Exceptionless" />
</configSections>
<exceptionless apiKey="oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI" serverUrl="http://localhost:8004" />
</configuration>
using Exceptionless.Configuration;
//[assembly: Exceptionless("oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI", ServerUrl = "http://localhost:8004")]
namespace ExceptionTest
{
class Program
{
static void Main(string[] args)
{
ExceptionlessClient.Default.Startup("oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI");
//var client = new ExceptionlessClient(c => {
// c.ApiKey = "oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI";
// c.ServerUrl = "http://localhost:8004";
//});
try
{
throw new Exception("test exception "+DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"));
}
catch (Exception ex)
{
//client.SubmitException(ex);
ex.ToExceptionless().Submit();
Console.WriteLine("error send");
}
Console.ReadKey();
}
}
}

这样就不需要在using那指定了。

接下来就可以在http://localhost:8004/#/type/error/dashboard中看到异常信息了。

最新文章

  1. IBatis.Net使用总结(二)-- IBatis返回DataTable/DataSet(网上例子的集合)
  2. [poj2349]Arctic Network(最小生成树+贪心)
  3. 用canvas制作酷炫射击游戏--part3
  4. 求SQL语句递归的算法
  5. ueditor1.3.6jsp版在struts2应用中上传图片报&quot;未找到上传文件&quot;解决方案
  6. Some Simple Models of Neurons
  7. 【ES5】hideProperty
  8. Android 操作系统的内存回收机制
  9. 一步一步学习SignalR进行实时通信_1_简单介绍
  10. sql server 数据页缓冲区的内存瓶颈分析
  11. HashBiMap
  12. 【转】基于Android Fragment功能的例子
  13. 在 JavaScript 中使用构造器函数模拟类
  14. linux目录结构特点
  15. Caused by: java.lang.ClassNotFoundException: backtype.storm.topology.IRichSpout
  16. Event 事件
  17. SVN提示https证书验证失败问题svn: E230001: Server SSL certificate verification failed:
  18. Python3基础 __getattr__ 访问不存在的属性时,新增提示功能
  19. 【转】嵌入式Linux驱动面试题三道
  20. ngular6开发不完全笔记(二)-- 管道

热门文章

  1. 潭州课堂25班:Ph201805201 python 操作数据库 第五课 (课堂笔记)
  2. Minor GC 与Full GC有什么不一样
  3. JavaScript:谈谈let和const
  4. BZOJ4374 : Little Elephant and Boxes
  5. 107. 二叉树的层次遍历 II
  6. ORACLE 内置函数之 GREATEST 和 LEAST(转)
  7. 关于数据库alter的一系列操作总结
  8. Java多线程:AQS
  9. DBProxy
  10. opencv rtsp 人脸识别