> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 自动崩溃转储收集

> 在 PlayFab Multiplayer Servers 的 Windows 容器生成上启用自动崩溃转储收集，以在托管的游戏服务器进程崩溃时捕获小型转储。

# 启用自动崩溃转储收集

本文将介绍如何为服务器启用自动崩溃转储收集。

<Note>
  此功能仅适用于 Windows 容器服务器。我们目前不提供 Linux 或基于 Windows 进程的服务器的方式。
</Note>

要启用自动崩溃转储收集，您可以使用 CreateBuildWithManagedContainer API，如下所示。要详细了解 CreateBuildwithManagedContainer，请参见 [Multiplayer Server - CreateBuild With Managed Container](https://learn.microsoft.com/en-us/rest/api/playfab/multiplayer/multiplayer-server/create-build-with-managed-container) 在 JSON 中，您可以向请求正文添加一个名为"WindowsCrashDumpConfiguration"的新字段来启用崩溃转储。

```Json theme={null}
    "BuildName": "crashDumpTest",
    "ContainerFlavor": "ManagedWindowsServerCore",
    "MultiplayerServerCountPerVm": 1,
    "Ports": [
        {
            "Name": "PortName",
            "Num": 1243,
            "Protocol": "TCP"
        }
    ],
    "RegionConfigurations": [
        {
            "Region": "EastUs",
            "MaxServers": 1,
            "StandbyServers": 1
        }
    ],
    "StartMultiplayerServerCommand": "C:\\Assets\\CrashingServerExample.exe sizeMiB:10",
    "UseStreamingForAssetDownloads": false,
    "GameAssetReferences": [
        {
            "FileName": "CrashingServerExample_v1_0.zip",
            "MountPath": "C:\\Assets"
        }
    ],
    "VmSize": "Standard_D2_v2",
    "WindowsCrashDumpConfiguration": {
        "IsEnabled": true,
        "DumpType": 0,
        "CustomDumpFlags": 6693
    }
}
```

<Note>
  启用后，您的 DumpType 和 CustomDumpFlag 值将放入注册表项中。要了解详细信息，请阅读[收集用户模式转储](https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps)
</Note>

服务器崩溃并创建日志后，PlayStream 通知将为您提供服务器 ID。获取服务器 ID 后，您可以在已归档服务器页面下搜索它。导航到已归档服务器页面并将您获得的服务器 ID 粘贴到搜索栏中。下载受影响服务器的日志，您将看到崩溃转储文件。要详细了解，请阅读[归档和检索多人服务器日志](/services/playfab/multiplayer/servers/archiving-and-retrieving-multiplayer-server-logs)


## Related topics

- [Crash data 页面](/zh-CN/tools/tools-console/wdp/windows-device-portal-on-xbox-crash-data.md)
- [XBOX 上的 Address Sanitizer 支持](/zh-CN/tools/tools-console/visualstudio/address-sanitizer-support.md)
- [CrashDetectedEventPayload](/zh-CN/services/playfab/api-references/events/data-types/crashdetectedeventpayload.md)
- [XBOX Gaming Explorer](/zh-CN/tools/tools-console/visualstudio/xbox-gaming-explorer.md)
- [xbWatson](/zh-CN/tools/tools-console/xbWatson/xbwatson.md)
