You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

D365 Business Central 2024本地版连接VSCode失败求助

D365 Business Central 2024本地租户连接VSCode失败排查求助

为学习用途安装了D365 Business Central 2024本地租户,尝试连接VSCode时遇到错误,错误日志如下:

[2024-06-02 14:02:44.73] Using reference symbols cache paths: [c:\Users\HP\Documents\AL\GeneratedProject2\.alpackages]
[2024-06-02 14:02:44.83] Targeting server 'http://localhost' and server instance 'BC240'.
[2024-06-02 14:02:44.83] Using Windows authentication.
[2024-06-02 14:02:44.86] Sending request to http://localhost:7049/BC240/dev/metadata
[2024-06-02 14:02:49.16] Error: Could not connect to the server. Please verify that:
1. The server is started.
2. The development endpoint is enabled (DeveloperServicesEnabled server setting).
3. The service name matches the one specified in the URL.
4. The port number matches the one specified in the URL (DeveloperServicesPort server setting).
5. The protocol matches the one specified in the URL (DeveloperServicesSSLEnabled server setting), and that a trusted certificate is used in case of an SSL connection.
[2024-06-02 14:02:49.16] Error: An error occured while processing the request.
Request ID: 906d6e3d-076e-45a0-9563-7eca2e6cb34a
Session ID: e32a782d-9e0f-49c0-ae7d-de0eebb505a6

已尝试操作:

  • 用管理员PowerShell修改开发端点但未成功
  • 卸载重装过应用

以下是具体排查思路:


基础配置验证

  • 确认BC服务状态:打开服务管理器(services.msc),找到Microsoft Dynamics 365 Business Central Server BC240服务,确认其处于运行状态。若未启动,右键启动并设置为自动启动。
  • 核对核心配置参数:
    1. 打开「Microsoft Dynamics 365 Business Central Server Administration」工具,选择BC240实例。
    2. 切换到Development标签页,确认DeveloperServicesEnabled勾选为Yes,DeveloperServicesPort设置为7049,DeveloperServicesSSLEnabled设置为No(匹配VSCode使用的http协议)。
    3. 检查实例名称是否为BC240,与VSCode配置中的实例名完全一致。

PowerShell配置命令修正

之前修改失败可重新执行以下管理员PowerShell命令,确保配置生效:

# 查看当前BC240实例的开发服务配置
Get-NAVServerConfiguration -ServerInstance BC240 -KeyName DeveloperServicesEnabled, DeveloperServicesPort, DeveloperServicesSSLEnabled

# 启用开发端点并设置端口
Set-NAVServerConfiguration -ServerInstance BC240 -KeyName DeveloperServicesEnabled -Value true
Set-NAVServerConfiguration -ServerInstance BC240 -KeyName DeveloperServicesPort -Value 7049
Set-NAVServerConfiguration -ServerInstance BC240 -KeyName DeveloperServicesSSLEnabled -Value false

# 重启BC服务使配置生效
Restart-NAVServerInstance -ServerInstance BC240

执行后留意命令输出,若有报错则根据提示调整(比如实例名拼写错误、权限不足)。

VSCode配置核对

打开项目中的launch.json文件,确认配置项与BC服务器匹配:

{
    "type": "al",
    "request": "launch",
    "name": "Local BC240",
    "server": "http://localhost",
    "serverInstance": "BC240",
    "authentication": "Windows",
    "port": 7049
}

网络与权限排查

  • 端口连通性测试:执行Test-NetConnection localhost -Port 7049命令,确认端口是否开放。若不通,检查Windows防火墙是否放行BC服务端口。
  • 用户权限验证:确保当前Windows用户拥有BC的开发权限,可在BC客户端中检查用户角色是否包含Super或Developer权限组。
  • 证书临时测试(若涉及SSL):若之前误开启SSL,可在VSCode配置中添加"allowInvalidCertificates": true临时测试连接。

深度日志排查

打开事件查看器,定位到Applications and Services Logs > Microsoft > DynamicsNAV > Server > BC240,查找与连接时间匹配的错误日志,里面会包含更具体的失败原因(比如配置冲突、权限不足)。


内容的提问来源于stack exchange,提问作者Tenthboxer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 05:07:33