我已经使用这个模板来开发我的应用程序,它是一个带有 Electron 构建器的 Vue 应用程序。现在我有一个问题: 我需要构建生产并部署我的项目一次作为电子包,另一次部署为托管在 Web 服务器上的 Web 应用程序。我也不想将它分成两个存储库。有人有什么建议吗?
我尝试使用 dist 文件夹作为网站的根文件夹,并添加了一个 web.config 文件,如下所示,但出现错误。
web.config文件内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Vue" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_URI}" pattern="^/api/.*" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
IIS 上的错误:
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
是的,您需要在 IIS 上安装 url 重写模块。否则,IIS 将无法理解
<rewrite> <rules> <rule name="Vue" stopProcessing="true">在 web.config 中的含义。从此处下载