34.1 在 IIS 部署
精简发布文件
如果需要精简发布后的文件,也就是删除不必要的文件夹,可以编辑 Web 项目的 .csproj
并添加 <SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
,如:
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
</PropertyGroup>
34.1.1 发布网站
34.1.1.1 选择启动项发布

34.1.1.2 选择发布到文件夹

34.1.1.3 配置发布后路径

34.1.1.4 点击发布

34.1.2 服务器环境配置
34.1.2.1 第一步
安装.NET Core 运行时捆绑包:点击下载
34.1.2.2 第二步(命令)
net stop was /y
34.1.2.3 第三步(命令)
net start w3svc
34.1.2.4 第四步(命令)
set ASPNETCORE_ENVIRONMENT=Production
34.1.3 部署到 IIS
34.1.3.1 添加新网站

34.1.3.2 配置网站信息

34.1.3.3 配置应用程序池

34.1.3.4 设置为 非托管

34.1.3.5 重启网站
只需重启网站或应用程序池即可。
34.1.4 常见问题
34.1.4.1 405 状态码,不支持 PUT,DELETE
请求
默认情况下,IIS
拒绝 PUT
和 DELETE
请求,原因为 IIS
默认注册了一个名为 WebDAVModule
的自定义 HttpModule
导致的。
解决该问题,只需要在 web.config
移除即可:
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="webDAVModule"/>
</modules>
<system.webServer>
</configuration>
34.1.5 反馈与建议
与我们交流
给 Furion 提 Issue。