{"id":37031322,"url":"https://github.com/netcorepal/healthcheck","last_synced_at":"2026-01-14T03:50:16.932Z","repository":{"id":49189689,"uuid":"95063926","full_name":"netcorepal/healthcheck","owner":"netcorepal","description":null,"archived":true,"fork":false,"pushed_at":"2021-06-24T10:14:26.000Z","size":610,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-22T11:19:57.497Z","etag":null,"topics":["health-check","healthcheck"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netcorepal.png","metadata":{"files":{"readme":"README.CN.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-22T01:58:14.000Z","updated_at":"2023-04-15T02:32:52.000Z","dependencies_parsed_at":"2022-09-11T13:21:30.706Z","dependency_job_id":null,"html_url":"https://github.com/netcorepal/healthcheck","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/netcorepal/healthcheck","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcorepal%2Fhealthcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcorepal%2Fhealthcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcorepal%2Fhealthcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcorepal%2Fhealthcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netcorepal","download_url":"https://codeload.github.com/netcorepal/healthcheck/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcorepal%2Fhealthcheck/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["health-check","healthcheck"],"created_at":"2026-01-14T03:50:16.352Z","updated_at":"2026-01-14T03:50:16.919Z","avatar_url":"https://github.com/netcorepal.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetCorePal.HealthCheck\n\n专为.net和.net core开发的健康检查工具，仅需极少的几行代码就可以完成服务以及服务所依赖的项目的健康检查，并且支持图形化方式呈现\n\n## 如何安装\n\n从nuget库安装基础组件NetCorePal.HealthCheck\n```\nInstall-Package NetCorePal.HealthCheck\n```\n\n如果使用asp.net或者asp.net mvc\n```\nInstall-Package NetCorePal.HealthCheck.Web\n```\n \n如果使用asp.net webapi\n```\nInstall-Package NetCorePal.HealthCheck.WebApi\n```\n\n如果使用asp.net owin web\n```\nInstall-Package NetCorePal.HealthCheck.Owin\n```\n\n\n如果使用.net core\n```\nInstall-Package NetCorePal.HealthCheck.AspNetCore\n```\n\n\n## 如何使用\n\n\n#### 添加健康检查\n```\nusing NetCorePal.HealthCheck；\n\nHealthCheckerManager.Manager.Add(new YourChecker()); //你对健康检查的业务逻辑处理\n或者\nHealthCheckerManager.Manager.Add(\"mycheckerName\",()=\u003e{ \n//你自己的业务逻辑\n    return new HealthCheckResult(){}; //add func as a checker\n\n}); \n\nHealthCheckerManager.Manager.AddAllDbConnectionHealthCheckers(); // 自动将web.config （.NET Framework 4.5+）中的数据库连接字符串作为依赖项加入健康检查 ，连接字符串中如果没有加入ProviderName，则默认使用MySQL\n\nHealthCheckerManager.Manager.AddHttpHeadHealthChecker(\"checkername\", \"url\");  // 有些情况下，你的项目只需返回Head信息来表示健康状况（比如阿里云的SLB对健康检查的支持），使用这个方法将不会对你项目的其他依赖项进行检查 \n```\n\n#### 如何获取健康检查结果\n\n```\nvar results = HealthCheckerManager.Manager.CheckAllAsync().Result;\n或者\nvar results = await HealthCheckerManager.Manager.CheckAllAsync(); //异步方法\n```\n\n#### 使用浏览器查看健康检查结果\n\n为了防止健康检查被外部攻击，我们支持使用密钥方式访问健康检查，一旦密钥不匹配，我们会立即返回失败结果而不会执行检查逻辑\n\nasp.net mvc\n```\nGlobal.asax.cs\n\nusing NetCorePal.HealthCheck;\n\nprotected void Application_Start()\n{\n    //  其他代码...\n    RouteTable.Routes.UseHealthCheck(url: \"healthcheck\", apiKey: \"密钥\");\n}\n```\n\nasp.net web api\n```\nGlobal.asax.cs\n\nusing NetCorePal.HealthCheck;\n\nprotected void Application_Start()\n{\n    //  其他代码...\n    GlobalConfiguration.Configuration.UseHealthCheck(url: \"/healthcheck\", apiKey: \"密钥\");\n}\n```\n\nasp.net owin web\n```\nStartup.cs\n\nusing NetCorePal.HealthCheck;\n\npublic void Configuration(IAppBuilder app)\n{\n    //  其他代码...\n     app.UseHealthCheck(url: \"/healthcheck\", apiKey: \"密钥\");\n}\n```\n\n\nasp.net core\n```\nStartup.cs\n\nusing NetCorePal.HealthCheck;\n\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env)\n{\n    app.UseHealthCheck(url: \"/healthcheck\", apiKey: \"密钥\");\n    \n    //  其他代码...\n}\n```\n\n浏览器中输入网址：\n```\nhttp://你的基础路径/healthcheck?apikey=密钥\n```\n\ncurl：\n```\ncurl http://你的基础路径/healthcheck?apikey=密钥\n```\n\nhead方法检查（head请求不需要密钥）\n```\ncurl --head http://你的基础路径/healthcheck\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetcorepal%2Fhealthcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetcorepal%2Fhealthcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetcorepal%2Fhealthcheck/lists"}