> For the complete documentation index, see [llms.txt](https://docs.zongsoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zongsoft.com/framework/web/controllers.md).

# 部署控制器插件

构建并部署 Discussions Web 类库，检查控制器发现和请求前提。

Discussions 的 API 项目是 Web 类库，OutputType 为 Library。它包含控制器但没有可独立启动的入口，必须与[Web 宿主](/hosting/web.md)及领域插件一起部署。

## 构建真实项目

先按[业务插件](/get-started/first-business-plugin.md)构建相邻 framework 的 [核心类库](https://github.com/Zongsoft/framework/tree/main/Zongsoft.Core) 和 Web，并保持相同的配置与目标框架。源码目录和 SDK 的准备见[准备环境](/get-started/prerequisites.md)。

{% code title="从 discussions 根目录构建 API" %}

```powershell
dotnet build src/api/Zongsoft.Discussions.Web.csproj -f net10.0 -p:ZongsoftFrameworkPathReferenced=true -p:GeneratePackageOnBuild=false
```

{% endcode %}

这会同时构建领域库。本地引用不会自动构建 framework；如果所用 NuGet 源已包含项目要求的[核心类库](https://github.com/Zongsoft/framework/tree/main/Zongsoft.Core)等依赖版本，可省略该开关并使用默认包引用方式。

## Web 清单依赖领域插件

来源：[src/api/Zongsoft.Discussions.Web.plugin](https://github.com/Zongsoft/Zongsoft.Discussions/blob/main/src/api/Zongsoft.Discussions.Web.plugin#L9)（节选；上下文见源文件）。

{% code title="Zongsoft.Discussions.Web.plugin" %}

```xml
<manifest>
	<dependencies>
		<dependency name="Zongsoft.Discussions" />
	</dependencies>

	<assemblies>
		<assembly name="Zongsoft.Discussions.Web" />
	</assemblies>
</manifest>
```

{% endcode %}

依赖保证先装配领域模块，程序集声明让宿主发现控制器。只部署 Web DLL 而漏掉领域映射、身份扩展和数据驱动，会导致控制器存在但业务调用失败。

## 随包交付的资源

来源：[src/api/Zongsoft.Discussions.Web.deploy](https://github.com/Zongsoft/Zongsoft.Discussions/blob/main/src/api/Zongsoft.Discussions.Web.deploy#L1)（节选；上下文见源文件）。

{% code title="Zongsoft.Discussions.Web.deploy" %}

```ini
artifacts/Zongsoft.Discussions.Web.plugin
lib/$(Framework)/Zongsoft.Discussions.Web.*

[templates]
artifacts/templates/*.xlsx
```

{% endcode %}

用户归档模板在 templates 中。项目还把 docs/http 请求文件打入 artifacts/http，供核对接口；请求中的地址与凭证必须由自己的环境提供。

## 验证路径

先确认 Discussions 和 [Discussions.Web](https://github.com/Zongsoft/discussions/tree/main/src/api) 清单加载，再确认 Threads、Forums、Users 等控制器进入应用模型。随后检查认证、站点、连接、映射和外部文件配置，最后验证查询与业务动作。

公开动作以控制器当前路由为准。仓库早期 docs/api.md 是历史接口草稿；未经核对，不应将其中的单数路径视为当前可执行范例。主题审核的具体代码见[请求与数据服务接口](/framework/web/data-services.md)。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zongsoft.com/framework/web/controllers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
