ASP.NET MVC向HockeyApp上报自定义崩溃失败求助
Let's break down why your crashes aren't showing up in HockeyApp, plus share proven integration steps for ASP.NET MVC:
1. The Core Issue: Mismatched Log Format
Your uploaded log is in Android crash report format, but HockeyApp parses logs differently based on the target platform. Since your service is ASP.NET MVC (.NET ecosystem), HockeyApp can't interpret the Android-style stack trace and system metadata—even though it accepted the request (hence the 201 status), it won't display unparseable logs in the dashboard.
2. Fixes for Manual Uploads
If you need to stick with curl-based uploads, you'll need to adjust two things:
- Add platform-specific parameters to tell HockeyApp this is a .NET crash:
curl -F "log=@dotnet_crash.log" -F "platform=Windows" -F "version=MY_APPLICATION_VERSION" -F "package=APPLICATION_PACKAGE_NAME" https://rink.hockeyapp.net/api/2/apps/MY_APPLICATION_ID/crashes/upload - Use a .NET-compatible log format: Your log should include .NET exception details, Windows OS info, and app metadata relevant to your ASP.NET MVC service (not Android device details).
3. Proven ASP.NET MVC Integration (Recommended)
Most developers use HockeyApp's official .NET SDK instead of manual curl uploads—it's more reliable and handles formatting automatically:
- Install the NuGet package:
Install-Package HockeyApp - Initialize HockeyApp in
Global.asax.cs:protected void Application_Start() { // Existing setup code (RouteConfig, FilterConfig, etc.) HockeyApp.Configure("MY_APPLICATION_ID"); } - Add a global exception filter to auto-capture crashes:
Create a filter class:
Register it inpublic class HockeyAppExceptionFilter : IExceptionFilter { public void OnException(ExceptionContext filterContext) { if (filterContext.Exception != null) { HockeyApp.MetricsManager.TrackException(filterContext.Exception); } } }FilterConfig.cs:public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); filters.Add(new HockeyAppExceptionFilter()); }
4. Quick Validation Steps
- Double-check your HockeyApp app settings: Ensure the platform is set to .NET/Windows (not Android) — this filters out incompatible logs.
- Test with the SDK first: Trigger a simple unhandled exception in your MVC app, then check the HockeyApp dashboard within a few minutes. If this works, your manual upload format was the problem.
内容的提问来源于stack exchange,提问作者Motaz

