其他分享
首页 > 其他分享> > Exceptionless 本地部署

Exceptionless 本地部署

作者:互联网

copy to:https://www.cnblogs.com/uptothesky/p/5864863.html

本地部署官方wiki

1.偷懒法

 在ExceptionLess文件解压目录找到 :Start.bat  运行,o'k 布置好了

 然后在下面看如何修改网站配置文件

PASS:

①命令不能执行:https://www.jb51.net/article/95022.htm

 

2.标准法

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

在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中看到异常信息了。

标签:Exceptionless,http,oXX5BJqhS30ni045BqthqJtiSnpB0naMactfmYmI,部署,ex,本地,8004,localh
来源: https://www.cnblogs.com/0to9/p/10483038.html